将内容添加到Facebook的饲料对话框从Facebook SDK为Android [英] Adding content to Facebook feed dialog from Facebook SDK for Android

查看:94
本文介绍了将内容添加到Facebook的饲料对话框从Facebook SDK为Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我希望用户在他们的墙上共享我的应用程序,所以我希望他们张贴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 :)

这篇关于将内容添加到Facebook的饲料对话框从Facebook SDK为Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆