2014-02-15 106 views
-1

我想發佈消息在我的朋友牆上,我有我的朋友列表和他們的Id現在我使用下面的代碼,但它不張貼任何消息給我的任何朋友牆,我會發布我的代碼,在我的上述代碼中,我使用的是朋友的靜態ID,但是它不會在我的朋友牆上發佈任何消息,如果我用我的FB ID替換ID,那麼它將發佈在我的牆上?發佈消息在我的朋友牆上sdk 3.5 android

private void getfriendlist() 
{ 
Session.openActiveSession(this, true, new Session.StatusCallback() 
{ // callback when session changes state @SuppressWarnings("deprecation") 
@Override 
public void call(final Session session, SessionState state, Exception exception) { if(session.isClosed()) 
{ 
Log.i("postStatusUpdate session.isClosed", "message not posted session is closed"); 
} if (session.isOpened()) 
{ // Log.i("session.isOpened", "session.isOpened"); //session.requestNewReadPermissions(newPermissionsRequest); 
if (!session.isOpened()) 
{ Session.OpenRequest openRequest = null; 
openRequest = new Session.OpenRequest(InvitefriendsActivity.this); 
if (openRequest != null) { //openRequest.setDefaultAudience(SessionDefaultAudience.FRIENDS); openRequest.setPermissions(Arrays.asList("email,user_birthday,user_location,user_hometown,user_about_me,user_relationships,publish_stream,publish_actions,basic_info,status_update","friends_birthday","read_friendlists")); //openRequest.setLoginBehavior(SessionLoginBehavior.SSO_WITH_FALLBACK); session.openForRead(openRequest); 
} } 
Request.executeMyFriendsRequestAsync(session, new Request.GraphUserListCallback() 
{ 
@Override public void onCompleted(List<GraphUser> users, Response response) { Log.d("AL",""+response.toString()); 
for (int i=0;i<users.size();i++) 
{ //Log.d("AL",""+users.get(i).toString()); 
Log.d("AL",""+users.get(i).getId()); 
Log.d("AL",""+users.get(i).asMap().get("name")); 
Bundle params = new Bundle(); 
params.putString("message", "Hi "); 
params.putString("caption", "Hello"); 
Request request = new Request(session, "100005147887121/feed", params, HttpMethod.POST); RequestAsyncTask task = new RequestAsyncTask(request); task.execute(); } } }); } } }); } 

回答

1

我認爲這與請求的權限有關。你(你的會議)是否允許發佈給其他人Wall?在這裏你會找到可用的權限

https://developers.facebook.com/docs/reference/login/extended-permissions/

我認爲你需要請求「publish_actions」

問候

邁克爾

+0

是的,我已經給所有的權限列表,並我已經閱讀了關於權限的所有內容,但是我已經閱讀了我們無法在第6版後的朋友牆上發佈消息,因爲圖表API中的某些更改, – Achin

相關問題