0

I'm trying to post some feeds with my application and i have a big problem... All of my post has visibility "Only Me".

I have set visibility to friends in mycode, but that does not work.

My question is : how to do for to have my posts with a friends visibilty...

This is my code :

    public void postOnWall() {
    // create a new permission request
    NewPermissionsRequest permissionRequest = new Session.NewPermissionsRequest(this, Arrays.asList("publish_actions", "offline_access"));
    // Default audience is friends
    // http://stackoverflow.com/questions/15738324/how-to-set-sessiondefaultaudience-for-facebook-in-android
    permissionRequest = permissionRequest.setDefaultAudience(SessionDefaultAudience.FRIENDS);
    // request for publish permission
    Session.getActiveSession().requestNewPublishPermissions(permissionRequest);
    //params for posting
    Bundle postParams = new Bundle();
    postParams.putString("message", "Some" + System.currentTimeMillis());
    //callback
    Request.Callback callback = new Request.Callback() {
        public void onCompleted(Response response) {
            JSONObject graphResponse = response.getGraphObject().getInnerJSONObject();
            String postId = null;
            try {
                postId = graphResponse.getString("id");
            } catch (JSONException e) {
                Log.i("asd", "JSON error " + e.getMessage());
            }
            FacebookRequestError error = response.getError();
            if (error != null) {
                jukastApp.toastIt(error.getErrorMessage());
            } else {
                jukastApp.toastIt(postId);
            }
        }
    };
    //do request
    Request request = new Request(Session.getActiveSession(), "me/feed", postParams, HttpMethod.POST, callback);
    //execute request
    RequestAsyncTask task = new RequestAsyncTask(request);
    task.execute();
}

This is what i have on facebook :

Actual

Expected :

Expected

Kevin ABRIOUX
  • 16,507
  • 12
  • 93
  • 99

1 Answers1

1

What is likely happening is that the app ceiling is set to Only Me and you can not exceed that. To check this, go look at the Application Settings. It will have a visibility setting. Despite what you post as the audience, you can not expand beyond that. To get around it, you can use the FacebookDialogs which will post via a switch to the FB app and allow the user to set it however they would like.

Dave Miller
  • 316
  • 1
  • 3