Facebook SDK 3.8 : permission publish_actions not returned

前端 未结 4 487
-上瘾入骨i
-上瘾入骨i 2021-02-06 04:07

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

相关标签:
4条回答
  • 2021-02-06 04:46

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

    0 讨论(0)
  • 2021-02-06 04:56

    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();
    
    0 讨论(0)
  • 2021-02-06 04:57

    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.

    0 讨论(0)
  • 2021-02-06 05:07

    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

    0 讨论(0)
提交回复
热议问题