Java Code Examples for com.facebook.internal.Utility#tryGetJSONObjectFromResponse()

The following examples show how to use com.facebook.internal.Utility#tryGetJSONObjectFromResponse() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LikeActionController.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
@Override
protected void processSuccess(GraphResponse response) {
    JSONObject results = Utility.tryGetJSONObjectFromResponse(
            response.getJSONObject(),
            objectId);
    if (results != null) {
        // See if we can get the OG object Id out
        JSONObject ogObject = results.optJSONObject("og_object");
        if (ogObject != null) {
            verifiedObjectId = ogObject.optString("id");
        }
    }
}
 
Example 2
Source File: LikeActionController.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
@Override
protected void processSuccess(GraphResponse response) {
    JSONObject results = Utility.tryGetJSONObjectFromResponse(
            response.getJSONObject(),
            objectId);
    if (results != null) {
        verifiedObjectId = results.optString("id");
        objectIsPage = !Utility.isNullOrEmpty(verifiedObjectId);
    }
}
 
Example 3
Source File: LikeActionController.java    From kognitivo with Apache License 2.0 5 votes vote down vote up
@Override
protected void processSuccess(GraphResponse response) {
    JSONObject engagementResults = Utility.tryGetJSONObjectFromResponse(
            response.getJSONObject(),
            "engagement");
    if (engagementResults != null) {
        // Missing properties in the response should default to cached like status
        likeCountStringWithLike =
                engagementResults.optString(
                        "count_string_with_like",
                        likeCountStringWithLike);

        likeCountStringWithoutLike =
                engagementResults.optString(
                        "count_string_without_like",
                        likeCountStringWithoutLike);

        socialSentenceStringWithLike =
                engagementResults.optString(
                        "social_sentence_with_like",
                        socialSentenceStringWithLike);

        socialSentenceStringWithoutLike =
                engagementResults.optString(
                        "social_sentence_without_like",
                        socialSentenceStringWithoutLike);
    }
}