public class FacebookConnect extends Login
Modifier and Type | Method and Description |
---|---|
void |
askPublishPermissions(LoginCallback lc)
Asks for publish permissions, this call might suspend the application
which might trigger repeated invocations of stop()/start().
|
protected Oauth2 |
createOauth2()
Creates the oauth2 to be used to login in case no native login is available
for this service.
|
void |
doLogout()
Logs out the current user from facebook
|
AccessToken |
getAccessToken()
The facebook token that can be used to access facebook functionality
|
static FacebookConnect |
getInstance()
Gets the FacebookConnect singleton instance
.
|
String |
getToken()
Deprecated.
use getAccessToken instead
|
boolean |
hasPublishPermissions()
Returns true if the current session already has publish permissions
|
void |
inviteFriends(String appLinkUrl,
String previewImageUrl)
Deprecated.
The Facebook SDK no longer supports app invites. https://developers.facebook.com/blog/post/2017/11/07/changes-developer-offerings/
|
void |
inviteFriends(String appLinkUrl,
String previewImageUrl,
Callback cb)
Deprecated.
The Facebook SDK no longer supports app invites https://developers.facebook.com/blog/post/2017/11/07/changes-developer-offerings/
|
boolean |
isFacebookSDKSupported()
Indicates whether the native platform supports native facebook login
|
boolean |
isInviteFriendsSupported()
Returns true if inviteFriends is implemented, it is supported on iOS and
Android
|
boolean |
isLoggedIn()
Deprecated.
use isUserLoggedIn() instead
|
boolean |
isNativeLoginSupported()
Returns true if this service supports native login.
|
void |
login()
Deprecated.
use doLogin
|
void |
logout()
Deprecated.
use doLogout instead
|
boolean |
nativeIsLoggedIn()
Indicates if the user is currently logged in.
|
void |
nativelogin()
Logs in the current user natively.
|
void |
nativeLogout()
Logs out the current user natively.
|
protected boolean |
validateToken(String token)
Returns true if the previous granted access token is still valid otherwise
false.
|
addScopes, connect, doLogin, doLogin, isPreferRedirectPrompt, isUserLoggedIn, setAccessToken, setCallback, setClientId, setClientSecret, setOauth2URL, setPreferRedirectPrompt, setRedirectURI, setScope, validateToken
public static FacebookConnect getInstance()
public boolean isFacebookSDKSupported()
public void login()
public void doLogout()
public AccessToken getAccessToken()
getAccessToken
in class Login
public boolean isLoggedIn()
public String getToken()
public void logout()
public void askPublishPermissions(LoginCallback lc)
public boolean hasPublishPermissions()
public boolean isNativeLoginSupported()
Login
isNativeLoginSupported
in class Login
protected Oauth2 createOauth2()
Login
createOauth2
in class Login
public void nativelogin()
Login
nativelogin
in class Login
public void nativeLogout()
Login
nativeLogout
in class Login
public boolean nativeIsLoggedIn()
Login
nativeIsLoggedIn
in class Login
public void inviteFriends(String appLinkUrl, String previewImageUrl)
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 nullpublic void inviteFriends(String appLinkUrl, String previewImageUrl, Callback cb)
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 nullcb
- 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.public boolean isInviteFriendsSupported()
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.
protected boolean validateToken(String token)
Login
validateToken
in class Login
token
- the access token to check