use of com.facebook.GraphRequest in project facebook-android-sdk by facebook.
the class Utility method awaitGetGraphMeRequestWithCache.
public static JSONObject awaitGetGraphMeRequestWithCache(final String accessToken) {
JSONObject cachedValue = ProfileInformationCache.getProfileInformation(accessToken);
if (cachedValue != null) {
return cachedValue;
}
GraphRequest graphRequest = getGraphMeRequestWithCache(accessToken);
GraphResponse response = graphRequest.executeAndWait();
if (response.getError() != null) {
return null;
}
return response.getJSONObject();
}
use of com.facebook.GraphRequest in project facebook-android-sdk by facebook.
the class FetchedAppSettingsManager method getAppSettingsQueryResponse.
// Note that this method makes a synchronous Graph API call, so should not be called from the
// main thread.
private static JSONObject getAppSettingsQueryResponse(String applicationId) {
Bundle appSettingsParams = new Bundle();
appSettingsParams.putString(APPLICATION_FIELDS, TextUtils.join(",", APP_SETTING_FIELDS));
GraphRequest request = GraphRequest.newGraphPathRequest(null, applicationId, null);
request.setSkipClientToken(true);
request.setParameters(appSettingsParams);
return request.executeAndWait().getJSONObject();
}
use of com.facebook.GraphRequest in project facebook-android-sdk by facebook.
the class UserSettingsFragment method fetchUserInfo.
private void fetchUserInfo() {
final AccessToken accessToken = AccessToken.getCurrentAccessToken();
if (accessToken != null) {
GraphRequest request = GraphRequest.newMeRequest(accessToken, new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject me, GraphResponse response) {
user = me;
updateUI();
}
});
Bundle parameters = new Bundle();
parameters.putString(FIELDS, REQUEST_FIELDS);
request.setParameters(parameters);
GraphRequest.executeBatchAsync(request);
} else {
user = null;
}
}
use of com.facebook.GraphRequest in project facebook-android-sdk by facebook.
the class PickerFragment method loadData.
/**
* Causes the picker to load data from the service and display it to the user.
*
* @param forceReload if true, data will be loaded even if there is already data being displayed (or loading);
* if false, data will not be re-loaded if it is already displayed (or loading)
* @param selectIds ids to select, if they are present in the loaded data
*/
public void loadData(boolean forceReload, Set<String> selectIds) {
if (!forceReload && loadingStrategy.isDataPresentOrLoading()) {
return;
}
selectionHint = selectIds;
clearResults();
GraphRequest request = getRequestForLoadData();
if (request != null) {
onLoadingData();
loadingStrategy.startLoading(request);
}
}
Aggregations