public class Facebook extends Object
Session
to manage session state,
Request
to make API requests, and
WebDialog
to make dialog requests.
Adding @Deprecated to this class causes warnings in other deprecated classes
that reference this one. That is the only reason this entire class is not
deprecated.Modifier and Type | Class and Description |
---|---|
static interface |
Facebook.DialogListener
Callback interface for dialog requests.
|
static interface |
Facebook.ServiceListener
Callback interface for service requests.
|
Modifier and Type | Field and Description |
---|---|
static String |
ATTRIBUTION_ID_COLUMN_NAME
Deprecated.
|
static Uri |
ATTRIBUTION_ID_CONTENT_URI
Deprecated.
|
static String |
CANCEL_URI
Deprecated.
|
protected static String |
DIALOG_BASE_URL
Deprecated.
|
static String |
EXPIRES
Deprecated.
|
static String |
FB_APP_SIGNATURE
Deprecated.
|
static int |
FORCE_DIALOG_AUTH
Deprecated.
|
protected static String |
GRAPH_BASE_URL
Deprecated.
|
static String |
REDIRECT_URI
Deprecated.
|
protected static String |
RESTSERVER_URL
Deprecated.
|
static String |
SINGLE_SIGN_ON_DISABLED
Deprecated.
|
static String |
TOKEN
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
authorize(Activity activity,
Facebook.DialogListener listener)
Deprecated.
|
void |
authorize(Activity activity,
String[] permissions,
Facebook.DialogListener listener)
Deprecated.
|
void |
authorize(Activity activity,
String[] permissions,
int activityCode,
Facebook.DialogListener listener)
Deprecated.
|
void |
authorizeCallback(int requestCode,
int resultCode,
Intent data)
Deprecated.
|
void |
dialog(Context context,
String action,
Bundle parameters,
Facebook.DialogListener listener)
Deprecated.
|
void |
dialog(Context context,
String action,
Facebook.DialogListener listener)
Deprecated.
|
boolean |
extendAccessToken(Context context,
Facebook.ServiceListener serviceListener)
Deprecated.
|
boolean |
extendAccessTokenIfNeeded(Context context,
Facebook.ServiceListener serviceListener)
Deprecated.
|
long |
getAccessExpires()
Deprecated.
|
String |
getAccessToken()
Deprecated.
|
String |
getAppId()
Deprecated.
|
static String |
getAttributionId(ContentResolver contentResolver)
Deprecated.
|
long |
getLastAccessUpdate()
Deprecated.
|
Session |
getSession()
Deprecated.
|
boolean |
getShouldAutoPublishInstall()
Deprecated.
|
boolean |
isSessionValid()
Deprecated.
|
String |
logout(Context context)
Deprecated.
|
boolean |
publishInstall(Context context)
Deprecated.
|
String |
request(Bundle parameters)
Deprecated.
|
String |
request(String graphPath)
Deprecated.
|
String |
request(String graphPath,
Bundle parameters)
Deprecated.
|
String |
request(String graphPath,
Bundle params,
String httpMethod)
Deprecated.
|
void |
setAccessExpires(long timestampInMsec)
Deprecated.
|
void |
setAccessExpiresIn(String expiresInSecsFromNow)
Deprecated.
|
void |
setAccessToken(String token)
Deprecated.
|
void |
setAppId(String appId)
Deprecated.
|
void |
setSession(Session session)
Deprecated.
|
void |
setShouldAutoPublishInstall(boolean value)
Deprecated.
|
void |
setTokenFromCache(String accessToken,
long accessExpires,
long lastAccessUpdate)
Deprecated.
|
boolean |
shouldExtendAccessToken()
Deprecated.
|
@Deprecated public static final String REDIRECT_URI
@Deprecated public static final String CANCEL_URI
@Deprecated public static final String TOKEN
@Deprecated public static final String EXPIRES
@Deprecated public static final String SINGLE_SIGN_ON_DISABLED
@Deprecated public static final Uri ATTRIBUTION_ID_CONTENT_URI
@Deprecated public static final String ATTRIBUTION_ID_COLUMN_NAME
@Deprecated public static final int FORCE_DIALOG_AUTH
@Deprecated protected static String DIALOG_BASE_URL
@Deprecated protected static String GRAPH_BASE_URL
@Deprecated protected static String RESTSERVER_URL
@Deprecated public static final String FB_APP_SIGNATURE
@Deprecated public Facebook(String appId)
appId
- Your Facebook application ID. Found at
www.facebook.com/developers/apps.php.@Deprecated public void authorize(Activity activity, Facebook.DialogListener listener)
@Deprecated public void authorize(Activity activity, String[] permissions, Facebook.DialogListener listener)
@Deprecated public void authorize(Activity activity, String[] permissions, int activityCode, Facebook.DialogListener listener)
Facebook
and Session
for more info.activity
- The Android activity in which we want to display the
authorization dialog.permissions
- A list of permissions required for this application: e.g.
"read_stream", "publish_stream", "offline_access", etc. see
http://developers.facebook.com/docs/authentication/permissions
This parameter should not be null -- if you do not require any
permissions, then pass in an empty String array.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. If you would like to force the use of legacy
dialog-based authorization, pass FORCE_DIALOG_AUTH for this
parameter. Otherwise just omit this parameter and Facebook
will use a suitable default. See
http://developer.android.com/reference/android/
app/Activity.html for more information.listener
- Callback interface for notifying the calling application when
the authentication dialog has completed, failed, or been
canceled.@Deprecated public void authorizeCallback(int requestCode, int resultCode, Intent data)
Facebook
and Session
for more info.@Deprecated public boolean extendAccessToken(Context context, Facebook.ServiceListener serviceListener)
Facebook
and Session
for more info.context
- The Android Context that will be used to bind to the Facebook
RefreshToken ServiceserviceListener
- Callback interface for notifying the calling application when
the refresh request has completed or failed (can be null). In
case of a success a new token can be found inside the result
Bundle under Facebook.ACCESS_TOKEN key.@Deprecated public boolean extendAccessTokenIfNeeded(Context context, Facebook.ServiceListener serviceListener)
Facebook
and Session
for more info.@Deprecated public boolean shouldExtendAccessToken()
Facebook
and Session
for more info.@Deprecated public String logout(Context context) throws MalformedURLException, IOException
Facebook
and Session
for more info.context
- The Android context in which the logout should be called: it
should be the same context in which the login occurred in
order to clear any stored cookiesIOException
MalformedURLException
@Deprecated public String request(Bundle parameters) throws MalformedURLException, IOException
Bundle parameters = new Bundle();
parameters.putString("method", "auth.expireSession");
String response = request(parameters);
This method is deprecated. See Facebook
and Request
for more info.parameters
- Key-value pairs of parameters to the request. Refer to the
documentation: one of the parameters must be "method".IOException
- if a network error occursMalformedURLException
- if accessing an invalid endpointIllegalArgumentException
- if one of the parameters is not "method"@Deprecated public String request(String graphPath) throws MalformedURLException, IOException
Facebook
and Request
for more info.graphPath
- Path to resource in the Facebook graph, e.g., to fetch data
about the currently logged authenticated user, provide "me",
which will fetch http://graph.facebook.com/meIOException
MalformedURLException
@Deprecated public String request(String graphPath, Bundle parameters) throws MalformedURLException, IOException
Facebook
and Request
for more info.graphPath
- Path to resource in the Facebook graph, e.g., to fetch data
about the currently logged authenticated user, provide "me",
which will fetch http://graph.facebook.com/meparameters
- key-value string parameters, e.g. the path "search" with
parameters "q" : "facebook" would produce a query for the
following graph resource:
https://graph.facebook.com/search?q=facebookIOException
MalformedURLException
@Deprecated public String request(String graphPath, Bundle params, String httpMethod) throws FileNotFoundException, MalformedURLException, IOException
Facebook
and Request
for more info.graphPath
- Path to resource in the Facebook graph, e.g., to fetch data
about the currently logged authenticated user, provide "me",
which will fetch http://graph.facebook.com/meparams
- Key-value string parameters, e.g. the path "search" with
parameters {"q" : "facebook"} would produce a query for the
following graph resource:
https://graph.facebook.com/search?q=facebookhttpMethod
- http verb, e.g. "GET", "POST", "DELETE"IOException
MalformedURLException
FileNotFoundException
@Deprecated public void dialog(Context context, String action, Facebook.DialogListener listener)
WebDialog
.context
- The Android context in which we will generate this dialog.action
- String representation of the desired method: e.g. "login",
"stream.publish", ...listener
- Callback interface to notify the application when the dialog
has completed.@Deprecated public void dialog(Context context, String action, Bundle parameters, Facebook.DialogListener listener)
WebDialog
.context
- The Android context in which we will generate this dialog.action
- String representation of the desired method: e.g. "feed" ...parameters
- String key-value pairs to be passed as URL parameters.listener
- Callback interface to notify the application when the dialog
has completed.@Deprecated public boolean isSessionValid()
@Deprecated public void setSession(Session session)
session
- the Session object to use, cannot be null@Deprecated public final Session getSession()
@Deprecated public String getAccessToken()
@Deprecated public long getAccessExpires()
@Deprecated public long getLastAccessUpdate()
@Deprecated public void setTokenFromCache(String accessToken, long accessExpires, long lastAccessUpdate)
Facebook
and Session
for more info.accessToken
- - access tokenaccessExpires
- - access token expiration timelastAccessUpdate
- - timestamp of the last token update@Deprecated public void setAccessToken(String token)
Facebook
and Session
for more info.token
- - access token@Deprecated public void setAccessExpires(long timestampInMsec)
Facebook
and Session
for more info.timestampInMsec
- - timestamp in milliseconds@Deprecated public void setAccessExpiresIn(String expiresInSecsFromNow)
Facebook
and Session
for more info.expiresInSecsFromNow
- - duration in seconds (or 0 if the session doesn't expire)@Deprecated public String getAppId()
@Deprecated public void setAppId(String appId)
appId
- the String representing the application ID@Deprecated public static String getAttributionId(ContentResolver contentResolver)
Facebook
and Settings
for more info.contentResolver
- @Deprecated public boolean getShouldAutoPublishInstall()
Facebook
and Settings
for more info.@Deprecated public void setShouldAutoPublishInstall(boolean value)
Facebook
and Settings
for more info.value
- a Boolean indicating whether installation of the app should be auto-published.@Deprecated public boolean publishInstall(Context context)
Facebook
and Settings
for more info.context
- the current Android context