由网友(ぃ老师比橡皮筋能扯)分享简介:在我的Android应用程序,我希望用户在他们的墙上共享我的应用程序,所以我希望他们张贴predefined内容的状态在他们的墙上。In my android app, I want users to "share" my app in their wall, so I want them to post a p...
在我的Android应用程序,我希望用户在他们的墙上共享我的应用程序,所以我希望他们张贴predefined内容的状态在他们的墙上。
In my android app, I want users to "share" my app in their wall, so I want them to post a predefined content status on their wall.
如何自墙壁状态? (我想补充我的应用程序图标,一些耀斑文本)。
How can I customize the wall status? (I want to add my app icon and some flare text).
推荐答案
下载Facebook的SDK,并将其导入您的项目。然后使用以下code认证:
Download the Facebook SDK and import it in your project. Then use the following code to Authorize:
public void sendtoFacebook(){
facebookClient = new Facebook("<Your_APP_ID");
facebookClient.authorize(<Current_class>.this, new AuthorizeListener());
}
现在,你必须添加以下methodes:
Now you have to add the following methodes:
class AuthorizeListener implements DialogListener {
public void onComplete(Bundle values) {
Bundle parameters = new Bundle();
parameters.putString("message", "<Message_you_want_to_send>");// the message to post to the wall
facebookClient.dialog(<Current_class>.this, "stream.publish", parameters, this);// "stream.publish" is an API call
}
@Override
public void onFacebookError(FacebookError e) {
}
@Override
public void onError(DialogError e) {
}
@Override
public void onCancel() {
}
}
您的应用程序名称和图标将被自动添加:)
Your Application name and Icon will automatically be added :)
相关推荐
最新文章