|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcom.parse.ParseFacebookUtils
public final class ParseFacebookUtils
Provides a set of utilities for using Parse with Facebook.
Field Summary | |
---|---|
protected static com.parse.FacebookAuthenticationProvider |
provider
|
Method Summary | |
---|---|
static void |
extendAccessToken(ParseUser user,
Context context,
SaveCallback callback)
Deprecated. This is now handled automatically by the Facebook SDK. |
static boolean |
extendAccessTokenIfNeeded(ParseUser user,
Context context,
SaveCallback callback)
Deprecated. This is now handled automatically by the Facebook SDK. |
static void |
finishAuthentication(int requestCode,
int resultCode,
Intent data)
Completes authentication after the Facebook app returns an activity result. |
static com.facebook.android.Facebook |
getFacebook()
Deprecated. Please use ParseFacebookUtils.getSession() and related Facebook SDK 3.0+ APIs instead. |
static com.facebook.Session |
getSession()
|
protected static void |
initialize()
|
static void |
initialize(String appId)
Initializes Facebook for use with Parse. |
static boolean |
isLinked(ParseUser user)
|
static void |
link(ParseUser user,
Activity activity)
Deprecated. Please use ParseFacebookUtils.linkInBackground(ParseUser, android.app.Activity) instead. |
static void |
link(ParseUser user,
Activity activity,
int activityCode)
Deprecated. Please use ParseFacebookUtils.linkInBackground(ParseUser, android.app.Activity, int) instead. |
static void |
link(ParseUser user,
Activity activity,
int activityCode,
SaveCallback callback)
|
static void |
link(ParseUser user,
Activity activity,
SaveCallback callback)
|
static void |
link(ParseUser user,
Collection<String> permissions,
Activity activity)
Deprecated. Please use ParseFacebookUtils.linkInBackground(ParseUser, java.util.Collection,
android.app.Activity) instead. |
static void |
link(ParseUser user,
Collection<String> permissions,
Activity activity,
int activityCode)
Deprecated. Please use ParseFacebookUtils.linkInBackground(ParseUser, java.util.Collection,
android.app.Activity, int) instead. |
static void |
link(ParseUser user,
Collection<String> permissions,
Activity activity,
int activityCode,
SaveCallback callback)
Links a ParseUser to a Facebook account, allowing you to use Facebook for authentication, and providing access to Facebook data for the user. |
static void |
link(ParseUser user,
Collection<String> permissions,
Activity activity,
SaveCallback callback)
Links a user using the default activity code if single sign-on is enabled. |
static void |
link(ParseUser user,
String facebookId,
String accessToken,
Date expirationDate)
Deprecated. Please use ParseFacebookUtils.linkInBackground(ParseUser, String, String, java.util.Date)
instead. |
static void |
link(ParseUser user,
String facebookId,
String accessToken,
Date expirationDate,
SaveCallback callback)
Links a ParseUser to a Facebook account, allowing you to use Facebook for authentication, and providing access to Facebook data for the user. |
static bolts.Task<Void> |
linkInBackground(ParseUser user,
Activity activity)
|
static bolts.Task<Void> |
linkInBackground(ParseUser user,
Activity activity,
int activityCode)
|
static bolts.Task<Void> |
linkInBackground(ParseUser user,
Collection<String> permissions,
Activity activity)
|
static bolts.Task<Void> |
linkInBackground(ParseUser user,
Collection<String> permissions,
Activity activity,
int activityCode)
Links a ParseUser to a Facebook account, allowing you to use Facebook for authentication, and providing access to Facebook data for the user. |
static bolts.Task<Void> |
linkInBackground(ParseUser user,
String facebookId,
String accessToken,
Date expirationDate)
Links a ParseUser to a Facebook account, allowing you to use Facebook for authentication, and providing access to Facebook data for the user. |
static void |
logIn(Activity activity,
int activityCode,
LogInCallback callback)
|
static void |
logIn(Activity activity,
LogInCallback callback)
|
static void |
logIn(Collection<String> permissions,
Activity activity,
int activityCode,
LogInCallback callback)
Logs in a ParseUser using Facebook for authentication. |
static void |
logIn(Collection<String> permissions,
Activity activity,
LogInCallback callback)
Logs in a user using the default activity code if single sign-on is enabled. |
static void |
logIn(String facebookId,
String accessToken,
Date expirationDate,
LogInCallback callback)
Logs in a ParseUser using Facebook for authentication. |
static bolts.Task<ParseUser> |
logInInBackground(Collection<String> permissions,
Activity activity,
int activityCode)
Logs in a ParseUser using Facebook for authentication. |
static bolts.Task<ParseUser> |
logInInBackground(String facebookId,
String accessToken,
Date expirationDate)
Logs in a ParseUser using Facebook for authentication. |
static void |
saveLatestSessionData(ParseUser user)
Deprecated. Please use ParseFacebookUtils.saveLatestSessionDataInBackground(ParseUser) instead. |
static void |
saveLatestSessionData(ParseUser user,
SaveCallback callback)
Saves the latest session data to the user. |
static bolts.Task<Void> |
saveLatestSessionDataInBackground(ParseUser user)
Saves the latest session data to the user. |
static boolean |
shouldExtendAccessToken(ParseUser user)
Deprecated. This is now handled automatically by the Facebook SDK. |
static void |
unlink(ParseUser user)
Unlinks a user from a Facebook account. |
static bolts.Task<Void> |
unlinkInBackground(ParseUser user)
Unlinks a user from a Facebook account in the background. |
static void |
unlinkInBackground(ParseUser user,
SaveCallback callback)
Unlinks a user from a Facebook account in the background. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static com.parse.FacebookAuthenticationProvider provider
Method Detail |
---|
@Deprecated public static com.facebook.android.Facebook getFacebook()
ParseFacebookUtils.getSession()
and related Facebook SDK 3.0+ APIs instead.
public static com.facebook.Session getSession()
public static boolean isLinked(ParseUser user)
true
if the user is linked to a Facebook account.protected static void initialize()
public static void initialize(String appId)
ParseFacebookUtils.logIn(Activity, int, LogInCallback)
or
ParseFacebookUtils.link(ParseUser, Activity, int, SaveCallback)
. You may invoke this method more than
once if you need to change the appId.
If this method is not called explicitly before using ParseFacebookUtils then the value of
com.facebook.sdk.ApplicationId from the manifest metadata will be used automatically.
IMPORTANT: If you choose to enable single sign-on, you must override the
Activity.onActivityResult(int, int, android.content.Intent)
method to invoke
ParseFacebookUtils.finishAuthentication(int, int, Intent)
.
appId
- The Facebook appId for your application.ParseFacebookUtils.logIn(Collection, Activity, int, LogInCallback)
,
ParseFacebookUtils.link(ParseUser, Collection, Activity, int, SaveCallback)
public static void unlink(ParseUser user) throws ParseException
user
- The user to unlink from Facebook.
ParseException
public static bolts.Task<Void> unlinkInBackground(ParseUser user)
user
- The user to unlink from Facebook.
public static void unlinkInBackground(ParseUser user, SaveCallback callback)
user
- The user to unlink from a Facebook account.callback
- Callback for notifying when unlinking is complete.public static bolts.Task<Void> linkInBackground(ParseUser user, String facebookId, String accessToken, Date expirationDate)
user
- The user to link to a Facebook account.facebookId
- The facebook ID of the user being linked.accessToken
- The access token for the user.expirationDate
- The expiration date of the access token.
@Deprecated public static void link(ParseUser user, String facebookId, String accessToken, Date expirationDate)
ParseFacebookUtils.linkInBackground(ParseUser, String, String, java.util.Date)
instead.
public static void link(ParseUser user, String facebookId, String accessToken, Date expirationDate, SaveCallback callback)
user
- The user to link to a Facebook account.facebookId
- The facebook ID of the user being linked.accessToken
- The access token for the user.expirationDate
- The expiration date of the access token.callback
- Callback for notifying when the new authentication data has been saved to the user.public static bolts.Task<Void> linkInBackground(ParseUser user, Collection<String> permissions, Activity activity, int activityCode)
authenticate()
method.
IMPORTANT: Note that single sign-on authentication will not function correctly if you do
not include a call to the finishAuthentication()
method in your onActivityResult()
function! Please see below for more information.
From the Facebook SDK documentation:
Starts either an Activity or a dialog which prompts the user to log in to Facebook and grant
the requested permissions to the given application.
This method will, when possible, use Facebook's single sign-on for Android to obtain an access
token. This involves proxying a call through the Facebook for Android stand-alone application,
which will handle the authentication flow, and return an OAuth access token for making API
calls.
Because this process will not be available for all users, if single sign-on is not possible,
this method will automatically fall back to the OAuth 2.0 User-Agent flow. In this flow, the
user credentials are handled by Facebook in an embedded WebView, not by the client application.
As such, the dialog makes a network request and renders HTML content rather than a native UI.
The access token is retrieved from a redirect to a special URL that the WebView handles.
user
- The user to link to a Facebook account.permissions
- A list of permissions to be used when logging in. Many of these constants are defined
here: ParseFacebookUtils.Permissions
.activity
- The Android activity in which we want to display the authorization dialog.activityCode
- Single sign-on requires an activity result to be called back to the client application
-- if you are waiting on other activities to return data, pass a custom activity code
here to avoid collisions.
public static bolts.Task<Void> linkInBackground(ParseUser user, Collection<String> permissions, Activity activity)
ParseFacebookUtils.linkInBackground(ParseUser, java.util.Collection, android.app.Activity, int)
,
FacebookAuthenticationProvider.DEFAULT_AUTH_ACTIVITY_CODE
public static bolts.Task<Void> linkInBackground(ParseUser user, Activity activity, int activityCode)
ParseFacebookUtils.linkInBackground(ParseUser, java.util.Collection, android.app.Activity, int)
public static bolts.Task<Void> linkInBackground(ParseUser user, Activity activity)
ParseFacebookUtils.linkInBackground(ParseUser, java.util.Collection, android.app.Activity, int)
,
FacebookAuthenticationProvider.DEFAULT_AUTH_ACTIVITY_CODE
public static void link(ParseUser user, Collection<String> permissions, Activity activity, int activityCode, SaveCallback callback)
authenticate()
method.
IMPORTANT: Note that single sign-on authentication will not function correctly if you do
not include a call to the finishAuthentication()
method in your onActivityResult()
function! Please see below for more information.
From the Facebook SDK documentation:
Starts either an Activity or a dialog which prompts the user to log in to Facebook and grant
the requested permissions to the given application.
This method will, when possible, use Facebook's single sign-on for Android to obtain an access
token. This involves proxying a call through the Facebook for Android stand-alone application,
which will handle the authentication flow, and return an OAuth access token for making API
calls.
Because this process will not be available for all users, if single sign-on is not possible,
this method will automatically fall back to the OAuth 2.0 User-Agent flow. In this flow, the
user credentials are handled by Facebook in an embedded WebView, not by the client application.
As such, the dialog makes a network request and renders HTML content rather than a native UI.
The access token is retrieved from a redirect to a special URL that the WebView handles.
user
- The user to link to a Facebook account.permissions
- A list of permissions to be used when logging in. Many of these constants are defined
here: ParseFacebookUtils.Permissions
.activity
- The Android activity in which we want to display the authorization dialog.activityCode
- Single sign-on requires an activity result to be called back to the client application
-- if you are waiting on other activities to return data, pass a custom activity code
here to avoid collisions.callback
- Callback for notifying the calling application when the Facebook authentication has
completed, failed, or been canceled.public static void link(ParseUser user, Collection<String> permissions, Activity activity, SaveCallback callback)
ParseFacebookUtils.link(ParseUser, Collection, Activity, int, SaveCallback)
@Deprecated public static void link(ParseUser user, Collection<String> permissions, Activity activity, int activityCode)
ParseFacebookUtils.linkInBackground(ParseUser, java.util.Collection,
android.app.Activity, int)
instead.
@Deprecated public static void link(ParseUser user, Collection<String> permissions, Activity activity)
ParseFacebookUtils.linkInBackground(ParseUser, java.util.Collection,
android.app.Activity)
instead.
public static void link(ParseUser user, Activity activity, int activityCode, SaveCallback callback)
ParseFacebookUtils.link(ParseUser, Collection, Activity, int, SaveCallback)
public static void link(ParseUser user, Activity activity, SaveCallback callback)
ParseFacebookUtils.link(ParseUser, Collection, Activity, int, SaveCallback)
@Deprecated public static void link(ParseUser user, Activity activity, int activityCode)
ParseFacebookUtils.linkInBackground(ParseUser, android.app.Activity, int)
instead.
@Deprecated public static void link(ParseUser user, Activity activity)
ParseFacebookUtils.linkInBackground(ParseUser, android.app.Activity)
instead.
public static bolts.Task<ParseUser> logInInBackground(String facebookId, String accessToken, Date expirationDate)
facebookId
- The facebook ID of the user being linked.accessToken
- The access token for the user.expirationDate
- The expiration date of the access token.
public static void logIn(String facebookId, String accessToken, Date expirationDate, LogInCallback callback)
facebookId
- The facebook ID of the user being linked.accessToken
- The access token for the user.expirationDate
- The expiration date of the access token.callback
- Callback for notifying when the new authentication data has been saved to the user.public static bolts.Task<ParseUser> logInInBackground(Collection<String> permissions, Activity activity, int activityCode)
authenticate()
method.
IMPORTANT: Note that single sign-on authentication will not function correctly if you do
not include a call to the finishAuthentication()
method in your onActivityResult()
function! Please see below for more information.
From the Facebook SDK documentation:
Starts either an Activity or a dialog which prompts the user to log in to Facebook and grant
the requested permissions to the given application.
This method will, when possible, use Facebook's single sign-on for Android to obtain an access
token. This involves proxying a call through the Facebook for Android stand-alone application,
which will handle the authentication flow, and return an OAuth access token for making API
calls.
Because this process will not be available for all users, if single sign-on is not possible,
this method will automatically fall back to the OAuth 2.0 User-Agent flow. In this flow, the
user credentials are handled by Facebook in an embedded WebView, not by the client application.
As such, the dialog makes a network request and renders HTML content rather than a native UI.
The access token is retrieved from a redirect to a special URL that the WebView handles.
permissions
- A list of permissions to be used when logging in. Many of these constants are defined
here: ParseFacebookUtils.Permissions
.activity
- The Android activity in which we want to display the authorization dialog.activityCode
- Single sign-on requires an activity result to be called back to the client application
-- if you are waiting on other activities to return data, pass a custom activity code
here to avoid collisions.
public static void logIn(Collection<String> permissions, Activity activity, int activityCode, LogInCallback callback)
authenticate()
method.
IMPORTANT: Note that single sign-on authentication will not function correctly if you do
not include a call to the finishAuthentication()
method in your onActivityResult()
function! Please see below for more information.
From the Facebook SDK documentation:
Starts either an Activity or a dialog which prompts the user to log in to Facebook and grant
the requested permissions to the given application.
This method will, when possible, use Facebook's single sign-on for Android to obtain an access
token. This involves proxying a call through the Facebook for Android stand-alone application,
which will handle the authentication flow, and return an OAuth access token for making API
calls.
Because this process will not be available for all users, if single sign-on is not possible,
this method will automatically fall back to the OAuth 2.0 User-Agent flow. In this flow, the
user credentials are handled by Facebook in an embedded WebView, not by the client application.
As such, the dialog makes a network request and renders HTML content rather than a native UI.
The access token is retrieved from a redirect to a special URL that the WebView handles.
permissions
- A list of permissions to be used when logging in. Many of these constants are defined
here: ParseFacebookUtils.Permissions
.activity
- The Android activity in which we want to display the authorization dialog.activityCode
- Single sign-on requires an activity result to be called back to the client application
-- if you are waiting on other activities to return data, pass a custom activity code
here to avoid collisions.callback
- Callback for notifying the calling application when the Facebook authentication has
completed, failed, or been canceled.public static void logIn(Activity activity, int activityCode, LogInCallback callback)
ParseFacebookUtils.logIn(Collection, Activity, int, LogInCallback)
public static void logIn(Collection<String> permissions, Activity activity, LogInCallback callback)
ParseFacebookUtils.logIn(Collection, Activity, int, LogInCallback)
public static void logIn(Activity activity, LogInCallback callback)
ParseFacebookUtils.logIn(Collection, Activity, int, LogInCallback)
public static void finishAuthentication(int requestCode, int resultCode, Intent data)
ParseFacebookUtils.logIn(Activity, int, LogInCallback)
or
ParseFacebookUtils.link(ParseUser, Activity, int, SaveCallback)
methods in ParseFacebookUtilities
. For more information, see http://developer.android.com/reference/android/app/
Activity.html#onActivityResult(int, int, android.content.Intent)
public static bolts.Task<Void> saveLatestSessionDataInBackground(ParseUser user)
user
- The user whose session information should be updated.
public static void saveLatestSessionData(ParseUser user, SaveCallback callback)
user
- The user whose session information should be updated.callback
- Callback invoked when the session data has been saved.@Deprecated public static void saveLatestSessionData(ParseUser user)
ParseFacebookUtils.saveLatestSessionDataInBackground(ParseUser)
instead.
@Deprecated public static boolean shouldExtendAccessToken(ParseUser user)
@Deprecated public static void extendAccessToken(ParseUser user, Context context, SaveCallback callback)
@Deprecated public static boolean extendAccessTokenIfNeeded(ParseUser user, Context context, SaveCallback callback)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |