[英]Posting on Facebook with Android SDK with friends visiblity
我正在尝试在应用程序中发布一些提要,但是我遇到了一个大问题……我所有的帖子都具有可见性“ Only Me”。
我已经在mycode中设置了对朋友的可见性,但这不起作用。
我的问题是:如何让我的朋友见到我的帖子...
这是我的代码:
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();
}
这是我在facebook上的内容:
预期:
可能发生的情况是应用程序上限设置为“仅我”,并且您不能超过该上限。 要检查这一点,请查看“应用程序设置”。 它将具有可见性设置。 尽管您作为听众发布了什么内容,但您不能超出此范围。 为了解决这个问题,您可以使用FacebookDialogs,它将通过开关发布到FB应用程序,并允许用户随意设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.