Android SDK Version
- AccessToken
- AccessToken.AccessTokenCreationCallback
- AccessToken.AccessTokenRefreshCallback
- AccessTokenManager
- AccessTokenSource
- AccessTokenTracker
- AddressFilterManager
- All
- AppEvent
- AppEventsConstants
- AppEventsLogger
- AppEventsLogger.FlushBehavior
- AppEventsLogger.ProductAvailability
- AppEventsLogger.ProductCondition
- AppEventsManager
- AppGroupCreationContent
- AppGroupCreationContent.AppGroupPrivacy
- AppGroupCreationContent.Builder
- AppInviteContent
- AppInviteContent.Builder
- AppInviteContent.Builder.Destination
- AppInviteDialog
- AppInviteDialog.Result
- AppLinkData
- AppLinkData.CompletionHandler
- AppLinks
- CallbackManager
- CallbackManager.Factory
- CameraEffectArguments
- CameraEffectArguments.Builder
- CameraEffectTextures
- CameraEffectTextures.Builder
- CodelessLoggingEventListener
- CodelessLoggingEventListener.AutoLoggingOnClickListener
- CodelessLoggingEventListener.AutoLoggingOnItemClickListener
- CodelessManager
- Common
- Core
- CreateAppGroupDialog
- CreateAppGroupDialog.Result
- CurrentAccessTokenExpirationBroadcastReceiver
- CurrentPlaceFeedbackRequestParams
- CurrentPlaceFeedbackRequestParams.Builder
- CurrentPlaceRequestParams
- CurrentPlaceRequestParams.Builder
- CurrentPlaceRequestParams.ConfidenceLevel
- CurrentPlaceRequestParams.ScanMode
- CustomTabActivity
- CustomTabLoginMethodHandler
- CustomTabMainActivity
- DefaultAudience
- DeviceAuthDialog
- DeviceLoginButton
- DeviceLoginManager
- DeviceShareButton
- DeviceShareDialog
- DeviceShareDialog.Result
- EventDeactivationManager
- FacebookActivity
- FacebookAppLinkResolver
- FacebookAuthorizationException
- FacebookBroadcastReceiver
- FacebookButtonBase
- FacebookCallback
- FacebookContentProvider
- FacebookDialog
- FacebookDialogException
- FacebookException
- FacebookGraphResponseException
- FacebookOperationCanceledException
- FacebookRequestError
- FacebookRequestError.Category
- FacebookSdk
- FacebookSdk.InitializeCallback
- FacebookSdkNotInitializedException
- FacebookServiceException
- FlushResult
- GameRequestContent
- GameRequestContent.ActionType
- GameRequestContent.Builder
- GameRequestContent.Filters
- GameRequestDialog
- GameRequestDialog.Result
- GraphRequest
- GraphRequest.Callback
- GraphRequest.GraphJSONArrayCallback
- GraphRequest.GraphJSONObjectCallback
- GraphRequest.OnProgressCallback
- GraphRequest.ParcelableResourceWithMimeType
- GraphRequestAsyncTask
- GraphRequestBatch
- GraphRequestBatch.Callback
- GraphRequestBatch.OnProgressCallback
- GraphResponse
- GraphResponse.PagingDirection
- HttpMethod
- InternalAppEventsLogger
- JoinAppGroupDialog
- JoinAppGroupDialog.Result
- LikeView
- LikeView.AuxiliaryViewPosition
- LikeView.HorizontalAlignment
- LikeView.ObjectType
- LikeView.OnErrorListener
- LikeView.Style
- LoggingBehavior
- Login
- LoginBehavior
- LoginButton
- LoginButton.ToolTipMode
- LoginFragment
- LoginManager
- LoginResult
- LoginStatusCallback
- MessageDialog
- Messenger
- MessengerThreadParams
- MessengerThreadParams.Origin
- MessengerUtils
- MetadataIndexer
- Model
- ModelManager
- PlaceFields
- PlaceInfoRequestParams
- PlaceInfoRequestParams.Builder
- PlaceManager
- PlaceManager.LocationError
- PlaceManager.OnRequestReadyCallback
- Places
- PlaceSearchRequestParams
- PlaceSearchRequestParams.Builder
- Profile
- ProfileManager
- ProfilePictureView
- ProfilePictureView.OnErrorListener
- ProfileTracker
- RCTCodelessLoggingEventListener
- RCTCodelessLoggingEventListener.AutoLoggingOnTouchListener
- RestrictiveDataManager
- SendButton
- Share
- ShareApi
- ShareBuilder
- ShareButton
- ShareButtonBase
- ShareCameraEffectContent
- ShareCameraEffectContent.Builder
- ShareContent
- ShareContent.Builder
- ShareDialog
- ShareDialog.Mode
- ShareGraphRequest
- ShareHashtag
- ShareHashtag.Builder
- ShareLinkContent
- ShareLinkContent.Builder
- ShareMedia
- ShareMedia.Builder
- ShareMedia.Type
- ShareMediaContent
- ShareMediaContent.Builder
- ShareMessengerActionButton
- ShareMessengerActionButton.Builder
- ShareMessengerGenericTemplateContent
- ShareMessengerGenericTemplateContent.Builder
- ShareMessengerGenericTemplateContent.ImageAspectRatio
- ShareMessengerGenericTemplateElement
- ShareMessengerGenericTemplateElement.Builder
- ShareMessengerMediaTemplateContent
- ShareMessengerMediaTemplateContent.Builder
- ShareMessengerMediaTemplateContent.MediaType
- ShareMessengerOpenGraphMusicTemplateContent
- ShareMessengerOpenGraphMusicTemplateContent.Builder
- ShareMessengerURLActionButton
- ShareMessengerURLActionButton.Builder
- ShareMessengerURLActionButton.WebviewHeightRatio
- ShareModel
- ShareModelBuilder
- ShareOpenGraphAction
- ShareOpenGraphAction.Builder
- ShareOpenGraphContent
- ShareOpenGraphContent.Builder
- ShareOpenGraphObject
- ShareOpenGraphObject.Builder
- ShareOpenGraphValueContainer
- ShareOpenGraphValueContainer.Builder
- SharePhoto
- SharePhoto.Builder
- SharePhotoContent
- SharePhotoContent.Builder
- Sharer
- Sharer.Result
- ShareStoryContent
- ShareStoryContent.Builder
- ShareToMessengerParams
- ShareToMessengerParamsBuilder
- ShareVideo
- ShareVideo.Builder
- ShareVideoContent
- ShareVideoContent.Builder
- SuggestedEventsManager
- ToolTipPopup
- ToolTipPopup.Style
- UserDataStore
- Utils
- ViewIndexer
- ViewOnClickListener
- WebDialog
- java.lang.Object
- com.facebook.AccessToken
public final class AccessToken
extends java.lang.Object
This class represents an immutable access token for using Facebook APIs. It also includes associated metadata such as expiration date and permissions. For more information on access tokens, see Access Tokens.
Nested Class Summary
Modifier and Type | Class and Description |
---|---|
static interface | AccessToken.AccessTokenCreationCallback A callback for creating an access token from a NativeLinkingIntent |
static interface | AccessToken.AccessTokenRefreshCallback |
Field Summary
Modifier and Type | Field and Description |
---|---|
static java.lang.String | ACCESS_TOKEN_KEY |
static <any> | CREATOR |
static java.lang.String | DATA_ACCESS_EXPIRATION_TIME |
static java.lang.String | EXPIRES_IN_KEY |
static java.lang.String | USER_ID_KEY |
Constructor Summary
Constructor and Description |
---|
AccessToken(java.lang.String accessToken, java.lang.String applicationId, java.lang.String userId, java.util.Collection<java.lang.String> permissions, java.util.Collection<java.lang.String> declinedPermissions, java.util.Collection<java.lang.String> expiredPermissions, AccessTokenSource accessTokenSource, java.util.Date expirationTime, java.util.Date lastRefreshTime, java.util.Date dataAccessExpirationTime) Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK). |
AccessToken(java.lang.String accessToken, java.lang.String applicationId, java.lang.String userId, java.util.Collection<java.lang.String> permissions, java.util.Collection<java.lang.String> declinedPermissions, java.util.Collection<java.lang.String> expiredPermissions, AccessTokenSource accessTokenSource, java.util.Date expirationTime, java.util.Date lastRefreshTime, java.util.Date dataAccessExpirationTime, java.lang.String graphDomain) Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK). |
Method Summary
Modifier and Type | Method and Description |
---|---|
static void | createFromNativeLinkingIntent(Intent intent, java.lang.String applicationId, AccessToken.AccessTokenCreationCallback accessTokenCallback) Creates a new AccessToken using the information contained in an Intent populated by the Facebook application in order to launch a native link. |
int | describeContents() |
boolean | equals(java.lang.Object other) |
java.lang.String | getApplicationId() Gets the ID of the Facebook Application associated with this access token. |
static AccessToken | getCurrentAccessToken() Getter for the access token that is current for the application. |
java.util.Date | getDataAccessExpirationTime() Gets the date at which user data access expires. |
java.util.Set<java.lang.String> | getDeclinedPermissions() Gets the list of permissions declined by the user with this access token. |
java.util.Set<java.lang.String> | getExpiredPermissions() Gets the list of permissions that were expired with this access token. |
java.util.Date | getExpires() Gets the date at which the access token expires. |
java.lang.String | getGraphDomain() Returns the graph domain for this access token. |
java.util.Date | getLastRefresh() Gets the date at which the token was last refreshed. |
java.util.Set<java.lang.String> | getPermissions() Gets the list of permissions associated with this access token. |
AccessTokenSource | getSource() Gets the AccessTokenSource indicating how this access token was obtained. |
java.lang.String | getToken() Gets the string representing the access token. |
java.lang.String | getUserId() Returns the user id for this access token. |
int | hashCode() |
static boolean | isCurrentAccessTokenActive() Returns whether the current AccessToken is active or not. |
static boolean | isDataAccessActive() |
boolean | isDataAccessExpired() Shows if the user data access is expired. |
boolean | isExpired() Shows if the token is expired. |
static void | refreshCurrentAccessTokenAsync() Updates the current access token with up to date permissions, and extends the expiration date, if extension is possible. |
static void | refreshCurrentAccessTokenAsync(AccessToken.AccessTokenRefreshCallback callback) Updates the current access token with up to date permissions, and extends the expiration date, if extension is possible. |
static void | setCurrentAccessToken(AccessToken accessToken) Setter for the access token that is current for the application. |
java.lang.String | toString() |
void | writeToParcel(Parcel dest, int flags) |
Field Detail
DATA_ACCESS_EXPIRATION_TIME
public static final java.lang.String DATA_ACCESS_EXPIRATION_TIME
See Also:
CREATOR
public static final <any> CREATOR
Constructor Detail
AccessToken
public AccessToken(java.lang.String accessToken, java.lang.String applicationId, java.lang.String userId, java.util.Collection<java.lang.String> permissions, java.util.Collection<java.lang.String> declinedPermissions, java.util.Collection<java.lang.String> expiredPermissions, AccessTokenSource accessTokenSource, java.util.Date expirationTime, java.util.Date lastRefreshTime, java.util.Date dataAccessExpirationTime)
Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK). Note that the caller is asserting that all parameters provided are correct with respect to the access token string; no validation is done to verify they are correct.
Parameters:
accessToken
- the access token string obtained from FacebookapplicationId
- the ID of the Facebook Application associated with this access tokenuserId
- the id of the userpermissions
- the permissions that were requested when the token was obtained (or when it was last reauthorized); may be null if permission set is unknowndeclinedPermissions
- the permissions that were declined when the token was obtained; may be null if permission set is unknownexpiredPermissions
- the permissions that were expired when the token was obtained; may be null if permission set is unknownaccessTokenSource
- an enum indicating how the token was originally obtained (in most cases, this will be either AccessTokenSource.FACEBOOK_APPLICATION or AccessTokenSource.WEB_VIEW); if null, FACEBOOK_APPLICATION is assumed.expirationTime
- the expiration date associated with the token; if null, an infinite expiration time is assumed (but will become correct when the token is refreshed)lastRefreshTime
- the last time the token was refreshed (or when it was first obtained); if null, the current time is used.dataAccessExpirationTime
- The time when user data access expiresAccessToken
public AccessToken(java.lang.String accessToken, java.lang.String applicationId, java.lang.String userId, java.util.Collection<java.lang.String> permissions, java.util.Collection<java.lang.String> declinedPermissions, java.util.Collection<java.lang.String> expiredPermissions, AccessTokenSource accessTokenSource, java.util.Date expirationTime, java.util.Date lastRefreshTime, java.util.Date dataAccessExpirationTime, java.lang.String graphDomain)
Creates a new AccessToken using the supplied information from a previously-obtained access token (for instance, from an already-cached access token obtained prior to integration with the Facebook SDK). Note that the caller is asserting that all parameters provided are correct with respect to the access token string; no validation is done to verify they are correct.
Parameters:
accessToken
- the access token string obtained from FacebookapplicationId
- the ID of the Facebook Application associated with this access tokenuserId
- the id of the userpermissions
- the permissions that were requested when the token was obtained (or when it was last reauthorized); may be null if permission set is unknowndeclinedPermissions
- the permissions that were declined when the token was obtained; may be null if permission set is unknownexpiredPermissions
- the permissions that were expired when the token was obtained; may be null if permission set is unknownaccessTokenSource
- an enum indicating how the token was originally obtained (in most cases, this will be either AccessTokenSource.FACEBOOK_APPLICATION or AccessTokenSource.WEB_VIEW); if null, FACEBOOK_APPLICATION is assumed.expirationTime
- the expiration date associated with the token; if null, an infinite expiration time is assumed (but will become correct when the token is refreshed)lastRefreshTime
- the last time the token was refreshed (or when it was first obtained); if null, the current time is used.dataAccessExpirationTime
- The time when user data access expiresgraphDomain
- The Graph API domain that this token is valid for.Method Detail
getCurrentAccessToken
public static AccessToken getCurrentAccessToken()
Getter for the access token that is current for the application.
Returns:
The access token that is current for the application.
isCurrentAccessTokenActive
public static boolean isCurrentAccessTokenActive()
Returns whether the current
AccessToken
is active or not.Returns:
true if the current AccessToken exists and has not expired; false, otherwise.
isDataAccessActive
public static boolean isDataAccessActive()
setCurrentAccessToken
public static void setCurrentAccessToken(AccessToken accessToken)
Setter for the access token that is current for the application.
Parameters:
accessToken
- The access token to set.refreshCurrentAccessTokenAsync
public static void refreshCurrentAccessTokenAsync()
Updates the current access token with up to date permissions, and extends the expiration date, if extension is possible.
refreshCurrentAccessTokenAsync
public static void refreshCurrentAccessTokenAsync(AccessToken.AccessTokenRefreshCallback callback)
Updates the current access token with up to date permissions, and extends the expiration date, if extension is possible.
Parameters:
callback
- getToken
public java.lang.String getToken()
Gets the string representing the access token.
Returns:
the string representing the access token
getExpires
public java.util.Date getExpires()
Gets the date at which the access token expires.
Returns:
the expiration date of the token
getDataAccessExpirationTime
public java.util.Date getDataAccessExpirationTime()
Gets the date at which user data access expires.
Returns:
the expiration date of the token
getPermissions
public java.util.Set<java.lang.String> getPermissions()
Gets the list of permissions associated with this access token. Note that the most up-to-date list of permissions is maintained by Facebook, so this list may be outdated if permissions have been added or removed since the time the AccessToken object was created. For more information on permissions, see https://developers.facebook.com/docs/reference/login/#permissions.
Returns:
a read-only list of strings representing the permissions granted via this access token
getDeclinedPermissions
public java.util.Set<java.lang.String> getDeclinedPermissions()
Gets the list of permissions declined by the user with this access token. It represents the entire set of permissions that have been requested and declined. Note that the most up-to-date list of permissions is maintained by Facebook, so this list may be outdated if permissions have been granted or declined since the last time an AccessToken object was created.
Returns:
a read-only list of strings representing the permissions declined by the user
getExpiredPermissions
public java.util.Set<java.lang.String> getExpiredPermissions()
Gets the list of permissions that were expired with this access token.
Returns:
a read-only list of strings representing the expired permissions
getSource
public AccessTokenSource getSource()
Gets the
AccessTokenSource
indicating how this access token was obtained.Returns:
the enum indicating how the access token was obtained
getLastRefresh
public java.util.Date getLastRefresh()
Gets the date at which the token was last refreshed. Since tokens expire, the Facebook SDK will attempt to renew them periodically.
Returns:
the date at which this token was last refreshed
getApplicationId
public java.lang.String getApplicationId()
Gets the ID of the Facebook Application associated with this access token.
Returns:
the application ID
getUserId
public java.lang.String getUserId()
Returns the user id for this access token.
Returns:
The user id for this access token.
getGraphDomain
public java.lang.String getGraphDomain()
Returns the graph domain for this access token.
Returns:
The graph domain for this access token.
createFromNativeLinkingIntent
public static void createFromNativeLinkingIntent(Intent intent, java.lang.String applicationId, AccessToken.AccessTokenCreationCallback accessTokenCallback)
Creates a new AccessToken using the information contained in an Intent populated by the Facebook application in order to launch a native link. For more information on native linking, please see https://developers.facebook.com/docs/mobile/android/deep_linking/.
Parameters:
intent
- the Intent that was used to start an Activity; must not be nullapplicationId
- the ID of the Facebook Application associated with this access tokentoString
public java.lang.String toString()
Overrides:
toString
in class java.lang.Object
equals
public boolean equals(java.lang.Object other)
Overrides:
equals
in class java.lang.Object
hashCode
public int hashCode()
Overrides:
hashCode
in class java.lang.Object
isExpired
public boolean isExpired()
Shows if the token is expired.
Returns:
true if the token is expired.
isDataAccessExpired
public boolean isDataAccessExpired()
Shows if the user data access is expired.
Returns:
true if the data access is expired.
describeContents
public int describeContents()
writeToParcel
public void writeToParcel(Parcel dest, int flags)