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 |
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,
AccessTokenSource accessTokenSource,
java.util.Date expirationTime,
java.util.Date lastRefreshTime)
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.Set<java.lang.String> |
getDeclinedPermissions()
Gets the list of permissions declined by the user with this access token.
|
java.util.Date |
getExpires()
Gets the date at which the access token expires.
|
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() |
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 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 AccessTokenSource accessTokenSource, @Nullable java.util.Date expirationTime, @Nullable java.util.Date lastRefreshTime)
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 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.public static AccessToken getCurrentAccessToken()
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.Set<java.lang.String> getPermissions()
public java.util.Set<java.lang.String> getDeclinedPermissions()
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 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.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isExpired()
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable