I\'m following the facebook android sharing tutorial by facebook (https://developers.facebook.com/docs/android/share). The app runs fine and I can login with facebook an click o
For publish permission you should send request in app settings and send for review, see https://developers.facebook.com/docs/apps/review/
It only returns read-permission, not the write permission. Try the snippet below
final Bundle permBundle = new Bundle();
permBundle.putCharSequence("permission", "publish_actions");
GraphRequest request = new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/me/permissions", permBundle, HttpMethod.GET,
new GraphRequest.Callback() {
@Override
public void onCompleted(GraphResponse graphResponse) {
Log.d(TAG, "response2: " + graphResponse.getJSONObject());
try {
JSONArray permList = (JSONArray) graphResponse.getJSONObject().get("data");
if(permList.length() == 0){
// no data for perms, hence asking permission
askForFBPublishPerm();
}else{
JSONObject permData = (JSONObject) permList.get(0);
String permVal = (String) permData.get("status");
if(permVal.equals("granted")){
postToFB();
}else{
askForFBPublishPerm();
}
}
} catch (JSONException e) {
Log.d(TAG, "exception while parsing fb check perm data" + e.toString());
}
}
}
);
request.executeAsync();
We were having the same issue here.
Try using:
Session.getActiveSession().refreshPermissions();
This will refresh the list of permissions available on
List<String> permissions = session.getPermissions();
It will only work with Facebook registered developers users or test users registered through the Facebook App Dashboard.
This worked for us.
if you are using Facebook sdk 3.14.x+ thn after april 30th facebook has changed the application testing and submission process. Posted answer regarding permission related. check this link