|
|||||||||
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.
Method Summary | |
---|---|
static void |
extendAccessToken(ParseUser user,
Context context,
SaveCallback callback)
Deprecated. |
static boolean |
extendAccessTokenIfNeeded(ParseUser user,
Context context,
SaveCallback callback)
Deprecated. |
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. |
static com.facebook.Session |
getSession()
|
static void |
initialize(String appId)
Initializes Facebook for use with Parse. |
static boolean |
isLinked(ParseUser user)
Returns true if the user is linked to a Facebook account. |
static void |
link(ParseUser user,
Activity activity)
|
static void |
link(ParseUser user,
Activity activity,
int activityCode)
|
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)
|
static void |
link(ParseUser user,
Collection<String> permissions,
Activity activity,
int activityCode)
|
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)
|
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 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 void |
saveLatestSessionData(ParseUser user)
|
static void |
saveLatestSessionData(ParseUser user,
SaveCallback callback)
Saves the latest session data to the user. |
static boolean |
shouldExtendAccessToken(ParseUser user)
Deprecated. |
static void |
unlink(ParseUser user)
Unlinks a user from a Facebook account. |
static void |
unlinkInBackground(ParseUser user)
|
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 |
Method Detail |
---|
@Deprecated public static com.facebook.android.Facebook getFacebook()
public static com.facebook.Session getSession()
public static boolean isLinked(ParseUser user)
true
if the user is linked to a Facebook account.
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.
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
ParseException
public static void unlinkInBackground(ParseUser user)
ParseFacebookUtils.unlinkInBackground(ParseUser)
public static void unlinkInBackground(ParseUser user, SaveCallback callback)
public static void link(ParseUser user, String facebookId, String accessToken, Date expirationDate)
ParseFacebookUtils.link(ParseUser, String, String, Date, SaveCallback)
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 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)
public static void link(ParseUser user, Collection<String> permissions, Activity activity, int activityCode)
ParseFacebookUtils.link(ParseUser, Collection, Activity, int, SaveCallback)
public static void link(ParseUser user, Collection<String> permissions, Activity activity)
ParseFacebookUtils.link(ParseUser, Collection, Activity, int, SaveCallback)
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)
public static void link(ParseUser user, Activity activity, int activityCode)
ParseFacebookUtils.link(ParseUser, Collection, Activity, int, SaveCallback)
public static void link(ParseUser user, Activity activity)
ParseFacebookUtils.link(ParseUser, Collection, Activity, int, SaveCallback)
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 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 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.public static void saveLatestSessionData(ParseUser user)
ParseFacebookUtils.saveLatestSessionData(ParseUser, SaveCallback)
@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 |