Android SDK Version
Field Summary
Modifier and TypeFieldDescription
private final IntegerMAXIMUM_BATCH_SIZE
private final StringACCESS_TOKEN_PARAM
private final StringFIELDS_PARAM
public final static GraphRequest.CompanionINSTANCE
Method Summary
Modifier and TypeMethodDescription
final StringgetDefaultBatchApplicationId() Gets the default Facebook application ID that will be used to submit batched requests.
final UnitsetDefaultBatchApplicationId(String applicationId) Sets the default application ID that will be used to submit batched requests if none of those requests specifies an access token.
final GraphRequestnewDeleteObjectRequest(AccessToken accessToken, String id, GraphRequest.Callback callback) Creates a new Request configured to delete a resource through the Graph API.
final GraphRequestnewMeRequest(AccessToken accessToken, GraphRequest.GraphJSONObjectCallback callback) Creates a new Request configured to retrieve a user's own profile.
final GraphRequestnewPostRequest(AccessToken accessToken, String graphPath, JSONObject graphObject, GraphRequest.Callback callback) Creates a new Request configured to post a GraphObject to a particular graph path, to either create or update the object at that path.
final GraphRequestnewPostRequestWithBundle(AccessToken accessToken, String graphPath, Bundle parameters, GraphRequest.Callback callback) Creates a new Request configured to post some parameters to a particular graph path.
final GraphRequestnewMyFriendsRequest(AccessToken accessToken, GraphRequest.GraphJSONArrayCallback callback) Creates a new Request configured to retrieve a user's friend list.
final GraphRequestnewGraphPathRequest(AccessToken accessToken, String graphPath, GraphRequest.Callback callback) Creates a new Request configured to retrieve a particular graph path.
final GraphRequestnewPlacesSearchRequest(AccessToken accessToken, Location location, Integer radiusInMeters, Integer resultsLimit, String searchText, GraphRequest.GraphJSONArrayCallback callback) Creates a new Request that is configured to perform a search for places near a specified location via the Graph API.
final GraphRequestnewUploadPhotoRequest(AccessToken accessToken, String graphPath, Bitmap image, String caption, Bundle params, GraphRequest.Callback callback) Creates a new Request configured to upload a photo to the specified graph path.
final GraphRequestnewUploadPhotoRequest(AccessToken accessToken, String graphPath, File file, String caption, Bundle params, GraphRequest.Callback callback) Creates a new Request configured to upload a photo to the specified graph path.
final GraphRequestnewUploadPhotoRequest(AccessToken accessToken, String graphPath, Uri photoUri, String caption, Bundle params, GraphRequest.Callback callback) Creates a new Request configured to upload a photo to the specified graph path.
final GraphRequestnewCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, String applicationId, GraphRequest.Callback callback) Creates a new Request configured to retrieve an App User ID for the app's Facebook user.
final GraphRequestnewCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, GraphRequest.Callback callback) Creates a new Request configured to retrieve an App User ID for the app's Facebook user.
final HttpURLConnectiontoHttpConnection(GraphRequest requests) Serializes one or more requests but does not execute them.
final HttpURLConnectiontoHttpConnection(Collection<GraphRequest> requests) Serializes one or more requests but does not execute them.
final HttpURLConnectiontoHttpConnection(GraphRequestBatch requests) Serializes one or more requests but does not execute them.
final GraphResponseexecuteAndWait(GraphRequest request) Executes a single request on the current thread and blocks while waiting for the response.
final List<GraphResponse>executeBatchAndWait(GraphRequest requests) Executes requests on the current thread as a single batch and blocks while waiting for the response.
final List<GraphResponse>executeBatchAndWait(Collection<GraphRequest> requests) Executes requests as a single batch on the current thread and blocks while waiting for the responses.
final List<GraphResponse>executeBatchAndWait(GraphRequestBatch requests) Executes requests on the current thread as a single batch and blocks while waiting for the responses.
final GraphRequestAsyncTaskexecuteBatchAsync(GraphRequest requests) Executes requests as a single batch asynchronously.
final GraphRequestAsyncTaskexecuteBatchAsync(Collection<GraphRequest> requests) Executes requests as a single batch asynchronously.
final GraphRequestAsyncTaskexecuteBatchAsync(GraphRequestBatch requests) Executes requests as a single batch asynchronously.
final List<GraphResponse>executeConnectionAndWait(HttpURLConnection connection, Collection<GraphRequest> requests) Executes requests that have already been serialized into an HttpURLConnection.
final List<GraphResponse>executeConnectionAndWait(HttpURLConnection connection, GraphRequestBatch requests) Executes requests that have already been serialized into an HttpURLConnection.
final GraphRequestAsyncTaskexecuteConnectionAsync(HttpURLConnection connection, GraphRequestBatch requests) Asynchronously executes requests that have already been serialized into an HttpURLConnection.
final GraphRequestAsyncTaskexecuteConnectionAsync(Handler callbackHandler, HttpURLConnection connection, GraphRequestBatch requests) Asynchronously executes requests that have already been serialized into an HttpURLConnection.
final IntegergetMAXIMUM_BATCH_SIZE() The maximum number of requests that can be submitted in a single batch.
final StringgetACCESS_TOKEN_PARAM()
final StringgetFIELDS_PARAM()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Method Detail

getDefaultBatchApplicationId

 final StringgetDefaultBatchApplicationId()
Gets the default Facebook application ID that will be used to submit batched requests. Batched requests require an application ID, so either at least one request in a batch must provide an access token or the application ID must be specified explicitly.

setDefaultBatchApplicationId

 final UnitsetDefaultBatchApplicationId(String applicationId)
Sets the default application ID that will be used to submit batched requests if none of those requests specifies an access token. Batched requests require an application ID, so either at least one request in a batch must specify an access token or the application ID must be specified explicitly.
Parameters:
applicationId - the Facebook application ID to use for batched requests if none can be determined

newDeleteObjectRequest

 final GraphRequestnewDeleteObjectRequest(AccessToken accessToken, String id, GraphRequest.Callback callback)
Creates a new Request configured to delete a resource through the Graph API.
Parameters:
accessToken - the access token to use, or null
id - the id of the object to delete
callback - a callback that will be called when the request is completed to handle success or error conditions

newMeRequest

 final GraphRequestnewMeRequest(AccessToken accessToken, GraphRequest.GraphJSONObjectCallback callback)
Creates a new Request configured to retrieve a user's own profile.
Parameters:
accessToken - the access token to use, or null
callback - a callback that will be called when the request is completed to handle success or error conditions

newPostRequest

 final GraphRequestnewPostRequest(AccessToken accessToken, String graphPath, JSONObject graphObject, GraphRequest.Callback callback)
Creates a new Request configured to post a GraphObject to a particular graph path, to either create or update the object at that path.
Parameters:
accessToken - the access token to use, or null
graphPath - the graph path to retrieve, create, or delete
graphObject - the graph object to create or update
callback - a callback that will be called when the request is completed to handle success or error conditions

newPostRequestWithBundle

 final GraphRequestnewPostRequestWithBundle(AccessToken accessToken, String graphPath, Bundle parameters, GraphRequest.Callback callback)
Creates a new Request configured to post some parameters to a particular graph path.
Parameters:
accessToken - the access token to use, or null
graphPath - the graph path to retrieve, create, or delete
parameters - the parameters to be carried in the request
callback - a callback that will be called when the request is completed to handle success or error conditions

newMyFriendsRequest

 final GraphRequestnewMyFriendsRequest(AccessToken accessToken, GraphRequest.GraphJSONArrayCallback callback)
Creates a new Request configured to retrieve a user's friend list.
Parameters:
accessToken - the access token to use, or null
callback - a callback that will be called when the request is completed to handle success or error conditions

newGraphPathRequest

 final GraphRequestnewGraphPathRequest(AccessToken accessToken, String graphPath, GraphRequest.Callback callback)
Creates a new Request configured to retrieve a particular graph path.
Parameters:
accessToken - the access token to use, or null
graphPath - the graph path to retrieve
callback - a callback that will be called when the request is completed to handle success or error conditions

newPlacesSearchRequest

 final GraphRequestnewPlacesSearchRequest(AccessToken accessToken, Location location, Integer radiusInMeters, Integer resultsLimit, String searchText, GraphRequest.GraphJSONArrayCallback callback)
Creates a new Request that is configured to perform a search for places near a specified location via the Graph API. At least one of location or searchText must be specified.
Parameters:
accessToken - the access token to use, or null
location - the location around which to search; only the latitude and longitude components of the location are meaningful
radiusInMeters - the radius around the location to search, specified in meters; this is ignored if no location is specified
resultsLimit - the maximum number of results to return
searchText - optional text to search for as part of the name or type of an object
callback - a callback that will be called when the request is completed to handle success or error conditions

newUploadPhotoRequest

 final GraphRequestnewUploadPhotoRequest(AccessToken accessToken, String graphPath, Bitmap image, String caption, Bundle params, GraphRequest.Callback callback)
Creates a new Request configured to upload a photo to the specified graph path.
Parameters:
accessToken - the access token to use, or null
graphPath - the graph path to use, defaults to me/photos
image - the bitmap image to upload
caption - the user generated caption for the photo, can be null
params - the parameters, can be null
callback - a callback that will be called when the request is completed to handle success or error conditions, can be null

newUploadPhotoRequest

 final GraphRequestnewUploadPhotoRequest(AccessToken accessToken, String graphPath, File file, String caption, Bundle params, GraphRequest.Callback callback)
Creates a new Request configured to upload a photo to the specified graph path. The photo will be read from the specified file.
Parameters:
accessToken - the access token to use, or null
graphPath - the graph path to use, defaults to me/photos
file - the file containing the photo to upload
caption - the user generated caption for the photo, can be null
params - the parameters, can be null
callback - a callback that will be called when the request is completed to handle success or error conditions, can be null

newUploadPhotoRequest

 final GraphRequestnewUploadPhotoRequest(AccessToken accessToken, String graphPath, Uri photoUri, String caption, Bundle params, GraphRequest.Callback callback)
Creates a new Request configured to upload a photo to the specified graph path. The photo will be read from the specified Uri.
Parameters:
accessToken - the access token to use, or null
graphPath - the graph path to use, defaults to me/photos
photoUri - the file:// or content:// Uri to the photo on device
caption - the user generated caption for the photo, can be null
params - the parameters, can be null
callback - a callback that will be called when the request is completed to handle success or error conditions, can be null

newCustomAudienceThirdPartyIdRequest

 final GraphRequestnewCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, String applicationId, GraphRequest.Callback callback)
Creates a new Request configured to retrieve an App User ID for the app's Facebook user. Callers will send this ID back to their own servers, collect up a set to create a Facebook Custom Audience with, and then use the resultant Custom Audience to target ads.
The GraphObject in the response will include a "custom_audience_third_party_id" property, with the value being the ID retrieved. This ID is an encrypted encoding of the Facebook user's ID and the invoking Facebook app ID. Multiple calls with the same user will return different IDs, thus these IDs cannot be used to correlate behavior across devices or applications, and are only meaningful when sent back to Facebook for creating Custom Audiences.
The ID retrieved represents the Facebook user identified in the following way: if the specified access token (or active access token if null) is valid, the ID will represent the user associated with the active access token; otherwise the ID will represent the user logged into the native Facebook app on the device. A null ID will be provided into the callback if a) there is no native Facebook app, b) no one is logged into it, or c) the app has previously called FacebookSdk.setLimitEventAndDataUsage ;} with true for this user. You must call this method from a background thread for it to work properly.
Parameters:
accessToken - the access token to issue the Request on, or null If there is no logged-in Facebook user, null is the expected choice.
context - the Application context from which the app ID will be pulled, and from which the 'attribution ID' for the Facebook user is determined.
applicationId - explicitly specified Facebook App ID.
callback - a callback that will be called when the request is completed to handle success or error conditions.

newCustomAudienceThirdPartyIdRequest

 final GraphRequestnewCustomAudienceThirdPartyIdRequest(AccessToken accessToken, Context context, GraphRequest.Callback callback)
Creates a new Request configured to retrieve an App User ID for the app's Facebook user. Callers will send this ID back to their own servers, collect up a set to create a Facebook Custom Audience with, and then use the resultant Custom Audience to target ads.
The GraphObject in the response will include a "custom_audience_third_party_id" property, with the value being the ID retrieved. This ID is an encrypted encoding of the Facebook user's ID and the invoking Facebook app ID. Multiple calls with the same user will return different IDs, thus these IDs cannot be used to correlate behavior across devices or applications, and are only meaningful when sent back to Facebook for creating Custom Audiences.
The ID retrieved represents the Facebook user identified in the following way: if the specified access token (or active access token if null) is valid, the ID will represent the user associated with the active access token; otherwise the ID will represent the user logged into the native Facebook app on the device. A null ID will be provided into the callback if a) there is no native Facebook app, b) no one is logged into it, or c) the app has previously called FacebookSdk.setLimitEventAndDataUsage with true for this user. You must call this method from a background thread for it to work properly.
Parameters:
accessToken - the access token to issue the Request on, or null If there is no logged-in Facebook user, null is the expected choice.
context - the Application context from which the app ID will be pulled, and from which the 'attribution ID' for the Facebook user is determined.
callback - a callback that will be called when the request is completed to handle success or error conditions.

toHttpConnection

 final HttpURLConnectiontoHttpConnection(GraphRequest requests)
Serializes one or more requests but does not execute them. The resulting HttpURLConnection can be executed explicitly by the caller.
Parameters:
requests - one or more Requests to serialize

toHttpConnection

 final HttpURLConnectiontoHttpConnection(Collection<GraphRequest> requests)
Serializes one or more requests but does not execute them. The resulting HttpURLConnection can be executed explicitly by the caller.
Parameters:
requests - one or more Requests to serialize

toHttpConnection

 final HttpURLConnectiontoHttpConnection(GraphRequestBatch requests)
Serializes one or more requests but does not execute them. The resulting HttpURLConnection can be executed explicitly by the caller.
Parameters:
requests - a RequestBatch to serialize

executeAndWait

 final GraphResponseexecuteAndWait(GraphRequest request)
Executes a single request on the current thread and blocks while waiting for the response.
This should only be used if you have transitioned off the UI thread.
Parameters:
request - the Request to execute

executeBatchAndWait

 final List<GraphResponse> executeBatchAndWait(GraphRequest requests)
Executes requests on the current thread as a single batch and blocks while waiting for the response.
This should only be used if you have transitioned off the UI thread.
Parameters:
requests - the Requests to execute

executeBatchAndWait

 final List<GraphResponse> executeBatchAndWait(Collection<GraphRequest> requests)
Executes requests as a single batch on the current thread and blocks while waiting for the responses.
This should only be used if you have transitioned off the UI thread.
Parameters:
requests - the Requests to execute

executeBatchAndWait

 final List<GraphResponse> executeBatchAndWait(GraphRequestBatch requests)
Executes requests on the current thread as a single batch and blocks while waiting for the responses.
This should only be used if you have transitioned off the UI thread.
Parameters:
requests - the batch of Requests to execute

executeBatchAsync

 final GraphRequestAsyncTaskexecuteBatchAsync(GraphRequest requests)
Executes requests as a single batch asynchronously. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the .setCallback method).
This should only be called from the UI thread.
Parameters:
requests - the Requests to execute

executeBatchAsync

 final GraphRequestAsyncTaskexecuteBatchAsync(Collection<GraphRequest> requests)
Executes requests as a single batch asynchronously. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the .setCallback method).
This should only be called from the UI thread.
Parameters:
requests - the Requests to execute

executeBatchAsync

 final GraphRequestAsyncTaskexecuteBatchAsync(GraphRequestBatch requests)
Executes requests as a single batch asynchronously. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the .setCallback method).
This should only be called from the UI thread.
Parameters:
requests - the RequestBatch to execute

executeConnectionAndWait

 final List<GraphResponse> executeConnectionAndWait(HttpURLConnection connection, Collection<GraphRequest> requests)
Executes requests that have already been serialized into an HttpURLConnection. No validation is done that the contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to ensure that it will correctly generate the desired responses.
This should only be called if you have transitioned off the UI thread.
Parameters:
connection - the HttpURLConnection that the requests were serialized into
requests - the requests represented by the HttpURLConnection

executeConnectionAndWait

 final List<GraphResponse> executeConnectionAndWait(HttpURLConnection connection, GraphRequestBatch requests)
Executes requests that have already been serialized into an HttpURLConnection. No validation is done that the contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to ensure that it will correctly generate the desired responses.
This should only be called if you have transitioned off the UI thread.
Parameters:
connection - the HttpURLConnection that the requests were serialized into
requests - the RequestBatch represented by the HttpURLConnection

executeConnectionAsync

 final GraphRequestAsyncTaskexecuteConnectionAsync(HttpURLConnection connection, GraphRequestBatch requests)
Asynchronously executes requests that have already been serialized into an HttpURLConnection. No validation is done that the contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to ensure that it will correctly generate the desired responses. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the .setCallback method).
This should only be called from the UI thread.
Parameters:
connection - the HttpURLConnection that the requests were serialized into
requests - the requests represented by the HttpURLConnection

executeConnectionAsync

 final GraphRequestAsyncTaskexecuteConnectionAsync(Handler callbackHandler, HttpURLConnection connection, GraphRequestBatch requests)
Asynchronously executes requests that have already been serialized into an HttpURLConnection. No validation is done that the contents of the connection actually reflect the serialized requests, so it is the caller's responsibility to ensure that it will correctly generate the desired responses. This function will return immediately, and the requests will be processed on a separate thread. In order to process results of a request, or determine whether a request succeeded or failed, a callback must be specified (see the .setCallback method)
This should only be called from the UI thread.
Parameters:
callbackHandler - a Handler that will be used to post calls to the callback for each request; if null, a Handler will be instantiated on the calling thread
connection - the HttpURLConnection that the requests were serialized into
requests - the requests represented by the HttpURLConnection

getMAXIMUM_BATCH_SIZE

 final IntegergetMAXIMUM_BATCH_SIZE()
The maximum number of requests that can be submitted in a single batch. This limit is enforced on the service side by the Facebook platform, not by the Request class.

getACCESS_TOKEN_PARAM

 final StringgetACCESS_TOKEN_PARAM()

getFIELDS_PARAM

 final StringgetFIELDS_PARAM()