如何使用Facebook的Android SDK中整合Android应用程序发布在Facebook墙上留言 [英] How to post message on facebook wall using Facebook android SDK integrate android app
问题描述
我正在开发社交应用程序,这个应用程序集成,我使用Facebook的SDK中的Facebook SDK
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
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);
}
});
}
我用这code不工作发布消息我的内涵是用户登陆Facebook的我的字符串是开放刚刚发布的墙后
i am using this code is not working to post message my intension is userlogin facebook my string is open just publish wall post
推荐答案
由于我也是在这个阶段学习,可你为什么要使用示例对话框听者mAsyn.request告诉我(我/饲料,。 ....).....
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",.....).....
什么是错误???
我想,如果你登录,只需拨打wallpostlistener在mAsync.request(ME /饲料,......,新WallPost ....)...这是我做我的应用程序。
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.
这篇关于如何使用Facebook的Android SDK中整合Android应用程序发布在Facebook墙上留言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!