use of com.facebook.Request in project phonegap-facebook-plugin by Wizcorp.
the class Utility method getAppSettingsQueryResponse.
// Note that this method makes a synchronous Graph API call, so should not be called from the main thread.
private static GraphObject getAppSettingsQueryResponse(String applicationId) {
Bundle appSettingsParams = new Bundle();
appSettingsParams.putString(APPLICATION_FIELDS, TextUtils.join(",", APP_SETTING_FIELDS));
Request request = Request.newGraphPathRequest(null, applicationId, null);
request.setSkipClientToken(true);
request.setParameters(appSettingsParams);
GraphObject response = request.executeAndWait().getGraphObject();
return response;
}
use of com.facebook.Request in project Klyph by jonathangerbaud.
the class KlyphPlacePickerFragment method createRequest.
private Request createRequest(Location location, int radiusInMeters, int resultsLimit, String searchText, Set<String> extraFields, Session session) {
Request request = Request.newPlacesSearchRequest(session, location, radiusInMeters, resultsLimit, searchText, null);
Set<String> fields = new HashSet<String>(extraFields);
String[] requiredFields = new String[] { ID, NAME, LOCATION, CATEGORY, WERE_HERE_COUNT };
fields.addAll(Arrays.asList(requiredFields));
String pictureField = adapter.getPictureFieldSpecifier();
if (pictureField != null) {
fields.add(pictureField);
}
Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);
return request;
}
use of com.facebook.Request in project facebook-api-android-maven by avianey.
the class PickerFragment method loadDataSkippingRoundTripIfCached.
private void loadDataSkippingRoundTripIfCached() {
clearResults();
Request request = getRequestForLoadData(getSession());
if (request != null) {
onLoadingData();
loadingStrategy.startLoading(request);
}
}
use of com.facebook.Request in project phonegap-facebook-plugin by Wizcorp.
the class PickerFragment method loadDataSkippingRoundTripIfCached.
private void loadDataSkippingRoundTripIfCached() {
clearResults();
Request request = getRequestForLoadData(getSession());
if (request != null) {
onLoadingData();
loadingStrategy.startLoading(request);
}
}
use of com.facebook.Request in project phonegap-facebook-plugin by Wizcorp.
the class ConnectPlugin method makeGraphCall.
private void makeGraphCall() {
Session session = Session.getActiveSession();
Request.Callback graphCallback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
if (graphContext != null) {
if (response.getError() != null) {
graphContext.error(getFacebookRequestErrorResponse(response.getError()));
} else {
GraphObject graphObject = response.getGraphObject();
graphContext.success(graphObject.getInnerJSONObject());
}
graphPath = null;
graphContext = null;
}
}
};
//If you're using the paging URLs they will be URLEncoded, let's decode them.
try {
graphPath = URLDecoder.decode(graphPath, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String[] urlParts = graphPath.split("\\?");
String graphAction = urlParts[0];
Request graphRequest = Request.newGraphPathRequest(null, graphAction, graphCallback);
Bundle params = graphRequest.getParameters();
if (urlParts.length > 1) {
String[] queries = urlParts[1].split("&");
for (String query : queries) {
int splitPoint = query.indexOf("=");
if (splitPoint > 0) {
String key = query.substring(0, splitPoint);
String value = query.substring(splitPoint + 1, query.length());
params.putString(key, value);
}
}
}
params.putString("access_token", session.getAccessToken());
graphRequest.setParameters(params);
graphRequest.executeAsync();
}
Aggregations