public final class AccessToken
extends java.lang.Object
implements android.os.Parcelable
| Modifier and Type | Class and Description |
|---|---|
static interface |
AccessToken.AccessTokenCreationCallback
A callback for creating an access token from a NativeLinkingIntent
|
static interface |
AccessToken.AccessTokenRefreshCallback |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACCESS_TOKEN_KEY |
static android.os.Parcelable.Creator<AccessToken> |
CREATOR |
static java.lang.String |
DATA_ACCESS_EXPIRATION_TIME |
static java.lang.String |
EXPIRES_IN_KEY |
static java.lang.String |
USER_ID_KEY |
| 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).
|
| Modifier and Type | Method and Description |
|---|---|
static void |
createFromNativeLinkingIntent(android.content.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(android.os.Parcel dest,
int flags) |
public static final java.lang.String ACCESS_TOKEN_KEY
public static final java.lang.String EXPIRES_IN_KEY
public static final java.lang.String USER_ID_KEY
public static final java.lang.String DATA_ACCESS_EXPIRATION_TIME
public static final android.os.Parcelable.Creator<AccessToken> CREATOR
public AccessToken(java.lang.String accessToken,
java.lang.String applicationId,
java.lang.String userId,
@Nullable
java.util.Collection<java.lang.String> permissions,
@Nullable
java.util.Collection<java.lang.String> declinedPermissions,
@Nullable
java.util.Collection<java.lang.String> expiredPermissions,
@Nullable
AccessTokenSource accessTokenSource,
@Nullable
java.util.Date expirationTime,
@Nullable
java.util.Date lastRefreshTime,
@Nullable
java.util.Date dataAccessExpirationTime)
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 expirespublic AccessToken(java.lang.String accessToken,
java.lang.String applicationId,
java.lang.String userId,
@Nullable
java.util.Collection<java.lang.String> permissions,
@Nullable
java.util.Collection<java.lang.String> declinedPermissions,
@Nullable
java.util.Collection<java.lang.String> expiredPermissions,
@Nullable
AccessTokenSource accessTokenSource,
@Nullable
java.util.Date expirationTime,
@Nullable
java.util.Date lastRefreshTime,
@Nullable
java.util.Date dataAccessExpirationTime,
@Nullable
java.lang.String graphDomain)
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.public static AccessToken getCurrentAccessToken()
public static boolean isCurrentAccessTokenActive()
AccessToken is active or not.public static boolean isDataAccessActive()
public static void setCurrentAccessToken(AccessToken accessToken)
accessToken - The access token to set.public static void refreshCurrentAccessTokenAsync()
public static void refreshCurrentAccessTokenAsync(AccessToken.AccessTokenRefreshCallback callback)
callback - public java.lang.String getToken()
public java.util.Date getExpires()
public java.util.Date getDataAccessExpirationTime()
public java.util.Set<java.lang.String> getPermissions()
public java.util.Set<java.lang.String> getDeclinedPermissions()
public java.util.Set<java.lang.String> getExpiredPermissions()
public AccessTokenSource getSource()
AccessTokenSource indicating how this access token was obtained.public java.util.Date getLastRefresh()
public java.lang.String getApplicationId()
public java.lang.String getUserId()
public java.lang.String getGraphDomain()
public static void createFromNativeLinkingIntent(android.content.Intent intent,
java.lang.String applicationId,
AccessToken.AccessTokenCreationCallback accessTokenCallback)
intent - the Intent that was used to start an Activity; must not be nullapplicationId - the ID of the Facebook Application associated with this access tokenpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean isExpired()
public boolean isDataAccessExpired()
public int describeContents()
describeContents in interface android.os.Parcelablepublic void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelable