permission error while posting custom story by FacebookSDk 4.0 in android

151 Views Asked by At

I want to post a custom story by FacebookSDK 4.0 My Application is also approved by facebook. but my problem is when I post story as a developer/admin role then the custom story successfully gets posted on facebook but custom story post as a simple user(who is not developer/admin) it gives permission error. like

I/System.out(30594): ResponseCustomStory{Response: responseCode: 500, graphObject: null, error: {HttpStatus: 500, errorCode: 200, errorType: FacebookApiException, errorMessage: Permissions error}}

and AccessToken debug in logcat like this

AccessToken token:ACCESS_TOKEN_REMOVED permissions:[user_friends, public_profile, publish_actions]}

my code is here> Before this I am already logged.

    FacebookSdk.sdkInitialize(activity);
    AccessToken access_token = AccessToken.getCurrentAccessToken();
    System.out.println("access_tokenincompleate" + access_token);

    SharedPreferences sp = activity.getSharedPreferences("profile",
            Context.MODE_PRIVATE);
    String pro_name = sp.getString("profileName", null);
    if (access_token != null) {

        if (hasPublishPermission()) {
            // We can do the action right away.
            handlePendingAction();

        } else {
            // We need to get new permissions, then complete the action when
            // we get called back.
            LoginManager.getInstance().logInWithPublishPermissions(
                    activity, Arrays.asList(PERMISSION));

        }
    }

    Bundle params = new Bundle();

    if(level == 1){
        params.putString("message",pro_name +" has completed  " + level
                + "st Level in Sosh");
    }else{
        params.putString("message",pro_name +" has completed  " + level
                + "st Level in Sosh");
    }
    // params.putString("level", "10");
    params.putString("level","http://ses.com/fbobjects/sbc_applink.php");

    // http://segs.com/fbobjects/customstory.html

    new GraphRequest(access_token, "me/namespace:complete", params,
            HttpMethod.POST, new GraphRequest.Callback() {
                public void onCompleted(GraphResponse response) {
                    /* handle the result */
                    System.out.println("ResponseCustomStory" + response);
                }
            }).executeAsync();

I submitted my game for review and it is approved and Live (for Publish_action permission).

Please help if someone has faced similar issue.

0

There are 0 best solutions below