[英]How to post message on facebook wall using Facebook android SDK integrate android app
i am developing social app this app integrate to facebook my app related message post to facebook wall i am using facebook sdk in facebook sdk 我正在开发社交应用程序这个应用程序集成到Facebook我的应用程序相关的消息发布到Facebook墙我在facebook sdk使用Facebook sdk
mPostButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
String message = "Post this to my wall";
Bundle parameters = new Bundle();
parameters.putString("message", message);
mAsyncRunner.request("me/feed", parameters, "POST", new SampleDialogListener());
}
});
mPostButton.setVisibility(mFacebook.isSessionValid() ?
View.VISIBLE :
View.INVISIBLE);
}
public class SampleDialogListener extends BaseDialogListener implements RequestListener {
public void onComplete(Bundle values) {
final String postId = values.getString("post_id");
if (postId != null) {
Log.d("Facebook-Example", "Dialog Success! post_id=" + postId);
mAsyncRunner.request(postId, new WallPostRequestListener());
} else {
Log.d("Facebook-Example", "No wall post made");
}
}
public class WallPostRequestListener extends BaseRequestListener {
public void onComplete(final String response, final Object state) {
Log.d("Facebook-Example", "Got response: " + response);
String message = "<empty>";
try {
JSONObject json = Util.parseJson(response);
message = json.getString("message");
} catch (JSONException e) {
Log.w("Facebook-Example", "JSON Error in response");
} catch (FacebookError e) {
Log.w("Facebook-Example", "Facebook Error: " + e.getMessage());
}
final String text = "Your Wall Post: " + message;
Example.this.runOnUiThread(new Runnable() {
public void run() {
mText.setText(text);
}
});
}
i am using this code is not working to post message my intension is userlogin facebook my string is open just publish wall post 我正在使用此代码不工作发布消息我的意图是userlogin facebook我的字符串是打开只是发布墙贴
As i am also a learner at this stage, Can you tell me why are you using sample dialog listener in mAsyn.request("me/feed",.....)..... 由于我在这个阶段也是学习者,你能告诉我为什么你在mAsyn.request中使用示例对话框监听器(“me / feed”,.....).....
What is the error??? 什么是错误???
I think, if you are logged in, just call wallpostlistener in mAsync.request("me/feed",...,new WallPost....)... this is what i do in my application. 我想,如果您已登录,只需在mAsync.request中调用wallpostlistener(“我/ feed”,...,新的WallPost ......)......这就是我在我的应用程序中所做的。
@narasimha if you don't want to deal with the intricacies of the Facebook SDK, you can check Socialize out. @narasimha如果你不想处理Facebook SDK的复杂性,你可以查看Socialize out。 http://www.GetSocialize.com with full feature list at http://go.GetSocialize.com/features . http://www.GetSocialize.com,其中包含完整的功能列表, 网址为http://go.GetSocialize.com/features 。 Good luck! 祝好运!
DROdio DROdio
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.