Good morning I'm trying to use the user_likes permission in an android application,
This is how I implement the request to bring the json with all the data
protected void getLikedPageInfo(LoginResult login_result){
Log.v("facebook","facebook token "+ login_result.getAccessToken().toString());
GraphRequest data_request = GraphRequest.newMeRequest(
login_result.getAccessToken(), new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject json_object, GraphResponse response) {
Log.v("facebook","facebook response "+ response);
try {
JSONArray posts = json_object.getJSONObject("likes").optJSONArray("data");
Log.v("facbook","facebook post "+ posts.toString());
for (int i = 0 ; i < posts.length();i++){
JSONObject post = posts.optJSONObject(i);
String id = post.optString("id");
String category = post.optString("category");
String name = post.optString("name");
int count = post.optInt("like");
Log.v("facebook", "facebook lista: " +"id "+ id+" category "+category+" name "+ name +" count "+ count);
}
} catch (Exception e){
Log.v("facebook","facebook error "+ e.getMessage());
}
}
}
);
Bundle permission_param = new Bundle();
permission_param.putString("fields","likes{id,category,name,location,likes}");
data_request.setParameters(permission_param);
data_request.executeAsync();
}
But in the log it tells me that it comes in null,
D/com.facebook.FacebookSdk: getGraphApiVersion: v3.0 07-09 13:40:49.150 21507-21527/mx.com.omnius.basechat D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=FacebookActivity, firebase_previous_id(_pi)=-3426805310557869296, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-3426805310557869299}]
07-09 13:40:49.493 21507-21532/mx.com.omnius.basechat E/GraphResponse: {HttpStatus: 400, errorCode: 10, subErrorCode: -1, errorType: OAuthException, errorMessage: (#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.}
07-09 13:40:49.503 21507-21507/mx.com.omnius.basechat V/facebook request api: cumpleaños: 03/21/1992
07-09 13:40:49.506 21507-21507/mx.com.omnius.basechat V/facebook: facebook response {Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 10, subErrorCode: -1, errorType: OAuthException, errorMessage: (#10) To use 'Page Public Content Access', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Page Public Content Access' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.}}
07-09 13:40:49.522 21507-21507/mx.com.omnius.basechat V/facebook: facebook error Attempt to invoke virtual method 'org.json.JSONObject org.json.JSONObject.getJSONObject(java.lang.String)' on a null object reference
I'm new using the facebook sdk, I'm going through some parameter wrong, I'd really appreciate it if someone gave me an idea of how to make it work. Thanks.