Facebook SDK 3.8 : permission publish_actions not returned

杀马特。学长 韩版系。学妹 提交于 2019-12-03 03:02:26

For publish permission you should send request in app settings and send for review, see https://developers.facebook.com/docs/apps/review/

user1140237

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

VSH

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.

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();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!