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, validateTokenModifier and TypeMethodDescriptionAdds the given scopes to the OAuth2 login request.connect()Connects to the login service asynchronously, automatically logging in if not yet logged in.voiddoLogin()Logs in the user.voiddoLogin(LoginCallback callback) Initiates login using the given single-use callback.booleanA flag used by the javascript port to indicate that the login will use a redirect for the prompt instead of a popup.booleanIndicates if the user is currently logged invoidsetAccessToken(AccessToken token) Sets the Login access tokenvoidSets the login callback that will receive event callback notification from the APIvoidsetClientId(String id) The client id (appid) which asks to connectvoidsetClientSecret(String secret) The client secretvoidsetOauth2URL(String oauth2URL) The oauth2 URLvoidsetPreferRedirectPrompt(boolean preferRedirectPrompt) A flag used by the javascript port to indicate that the login will use a redirect for the prompt instead of a popup.voidsetRedirectURI(String redirectURI) The redirect URIvoidThe authentication scopevoidThis method tries to validate the last access token if exists, if the last token is not valid anymore it will try to login the user in order to get a fresh token The method blocks until a valid token has been grantedMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()booleanIndicates whether some other object is "equal to" this one.final ClassgetClass()Returns the runtime class of an object.inthashCode()Returns a hash code value for the object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes current thread to wait until another thread invokes the method or the method for this object.final voidwait(long timeout) Causes current thread to wait until either another thread invokes the method or the method for this object, or a specified amount of time has elapsed.final voidwait(long timeout, int nanos) Causes current thread to wait until another thread invokes the method or the method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
-
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
-