Class FacebookConnect
-
Method Summary
Modifier and TypeMethodDescriptionvoidAsks for publish permissions, this call might suspend the application which might trigger repeated invocations of stop()/start().protected Oauth2Creates the oauth2 to be used to login in case no native login is available for this service.voiddoLogout()Logs out the current user from facebookThe facebook token that can be used to access facebook functionalitystatic FacebookConnectGets the FacebookConnect singleton instance .getToken()The facebook token that can be used to access facebook functionalitybooleanReturns true if the current session already has publish permissionsvoidinviteFriends(String appLinkUrl, String previewImageUrl) Opens and invite dialog to invite friends to the app https://developers.facebook.com/docs/app-invitesvoidinviteFriends(String appLinkUrl, String previewImageUrl, Callback cb) Opens and invite dialog to invite friends to the app https://developers.facebook.com/docs/app-invitesbooleanIndicates whether the native platform supports native facebook loginbooleanReturns true if inviteFriends is implemented, it is supported on iOS and AndroidbooleanIndicates if the user is currently logged inbooleanReturns true if this service supports native login.voidlogin()Logs into facebook, notice that this call might suspend the application which might trigger repeated invocations of stop()/start() etc.voidlogout()Logs out the current user from facebookbooleanIndicates if the user is currently logged in.voidLogs in the current user natively.voidLogs out the current user natively.protected booleanvalidateToken(String token) Returns true if the previous granted access token is still valid otherwise false.Methods inherited from class Login
addScopes, connect, doLogin, doLogin, isPreferRedirectPrompt, isUserLoggedIn, setAccessToken, setCallback, setClientId, setClientSecret, setOauth2URL, setPreferRedirectPrompt, setRedirectURI, setScope, validateToken
-
Method Details
-
getInstance
Gets the FacebookConnect singleton instance .
Returns
the FacebookConnect instance
-
isFacebookSDKSupported
public boolean isFacebookSDKSupported()Indicates whether the native platform supports native facebook login
Returns
true if supported
-
login
public void login()Logs into facebook, notice that this call might suspend the application which might trigger repeated invocations of stop()/start() etc. This is due to the facebook SDK spawning a separate process to perform the login then returning to the application. Once logged in the facebook credentials will be available.
Deprecated
use doLogin
-
doLogout
-
getAccessToken
The facebook token that can be used to access facebook functionality
Returns
the token
- Overrides:
getAccessTokenin classLogin
-
isLoggedIn
public boolean isLoggedIn()Indicates if the user is currently logged in
Returns
true if logged in
Deprecated
use isUserLoggedIn() instead
-
getToken
The facebook token that can be used to access facebook functionality
Returns
the token
Deprecated
use getAccessToken instead
-
logout
public void logout()Logs out the current user from facebook
Deprecated
use doLogout instead
-
askPublishPermissions
Asks for publish permissions, this call might suspend the application which might trigger repeated invocations of stop()/start(). -
hasPublishPermissions
public boolean hasPublishPermissions()Returns true if the current session already has publish permissions -
isNativeLoginSupported
public boolean isNativeLoginSupported()Description copied from class:LoginReturns true if this service supports native login. If implementation returns true here, the nativelogin, nativelogout, nativeIsLoggedIn should be implemented
Returns
true if the service supports native login
- Specified by:
isNativeLoginSupportedin classLogin
-
createOauth2
Description copied from class:LoginCreates the oauth2 to be used to login in case no native login is available for this service.
Returns
- Overrides:
createOauth2in classLogin- Returns:
- the Oauth2 to be used to login if no native login available and on the simulator
-
nativelogin
public void nativelogin()Description copied from class:LoginLogs in the current user natively. Subclasses that uses a native sdk to login/logout should override this method.- Overrides:
nativeloginin classLogin
-
nativeLogout
public void nativeLogout()Description copied from class:LoginLogs out the current user natively. Subclasses that uses a native sdk to login/logout should override this method.- Overrides:
nativeLogoutin classLogin
-
nativeIsLoggedIn
public boolean nativeIsLoggedIn()Description copied from class:LoginIndicates if the user is currently logged in. Subclasses that uses a native sdk to login/logout should override this method.
Returns
true if logged in
- Overrides:
nativeIsLoggedInin classLogin
-
inviteFriends
Opens and invite dialog to invite friends to the app https://developers.facebook.com/docs/app-invites
Parameters
-
appLinkUrl: @param appLinkUrl App Link for what should be opened when the recipient clicks on the install/play button on the app invite page. -
previewImageUrl: url to an image to be used in the invite, can be null
Deprecated
The Facebook SDK no longer supports app invites. https://developers.facebook.com/blog/post/2017/11/07/changes-developer-offerings/
-
-
inviteFriends
Opens and invite dialog to invite friends to the app https://developers.facebook.com/docs/app-invites
Parameters
-
appLinkUrl: @param appLinkUrl App Link for what should be opened when the recipient clicks on the install/play button on the app invite page. -
previewImageUrl: url to an image to be used in the invite, can be null -
cb: @param cb a Callback to be used when we need to know if the Facebook invite was successful. If the invite was successful the onSucess method will be called If the user canceled the onError method will be called with error code -1. If an error occurred the onError method will be called with error code 0.
Deprecated
The Facebook SDK no longer supports app invites https://developers.facebook.com/blog/post/2017/11/07/changes-developer-offerings/
-
-
isInviteFriendsSupported
public boolean isInviteFriendsSupported()Returns true if inviteFriends is implemented, it is supported on iOS and Android
NOTE: Since updating to Facebook SDK 5.6.0 (April 1, 2020), invite friends is no longer supported on iOS. It will eventually be removed from Android as well, as Facebook no longer supports App invites in its native SDKs.
Returns
true if inviteFriends is implemented
-
validateToken
Description copied from class:LoginReturns true if the previous granted access token is still valid otherwise false.
Parameters
token: the access token to check
Returns
true of the token is valid
- Specified by:
validateTokenin classLogin
-