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 :
Expected :