Search in sources :

Example 6 with Request

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;
}
Also used : Bundle(android.os.Bundle) Request(com.facebook.Request) GraphObject(com.facebook.model.GraphObject)

Example 7 with Request

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;
}
Also used : Bundle(android.os.Bundle) Request(com.facebook.Request) HashSet(java.util.HashSet)

Example 8 with 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);
    }
}
Also used : Request(com.facebook.Request)

Example 9 with 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);
    }
}
Also used : Request(com.facebook.Request)

Example 10 with 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();
}
Also used : Response(com.facebook.Response) GraphUserCallback(com.facebook.Request.GraphUserCallback) Bundle(android.os.Bundle) Request(com.facebook.Request) UnsupportedEncodingException(java.io.UnsupportedEncodingException) GraphObject(com.facebook.model.GraphObject) Session(com.facebook.Session)

Aggregations

Request (com.facebook.Request)13 Bundle (android.os.Bundle)8 Response (com.facebook.Response)4 Session (com.facebook.Session)4 GraphObject (com.facebook.model.GraphObject)3 GraphUser (com.facebook.model.GraphUser)3 FacebookRequestError (com.facebook.FacebookRequestError)2 GraphUserListCallback (com.facebook.Request.GraphUserListCallback)2 Random (java.util.Random)2 GraphUserCallback (com.facebook.Request.GraphUserCallback)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 HashSet (java.util.HashSet)1