相关疑难解决方法(0)

XMPP与Java Asmack库支持X-FACEBOOK-PLATFORM

我正在尝试使用Smack库在Android上进行Facebook聊天.我已经从Facebook上阅读了聊天API,但我无法理解如何使用此库对Facebook进行身份验证.

任何人都可以指出我如何做到这一点?

更新:根据no.good.at.coding答案,我将此代码改编为Asmack库.一切正常,但我收到的是对登录的回复:未经授权.这是我使用的代码:

public class SASLXFacebookPlatformMechanism extends SASLMechanism
{

    private static final String NAME              = "X-FACEBOOK-PLATFORM";

    private String              apiKey            = "";
    private String              applicationSecret = "";
    private String              sessionKey        = "";

    /**
     * Constructor.
     */
    public SASLXFacebookPlatformMechanism(SASLAuthentication saslAuthentication)
    {
        super(saslAuthentication);
    }

    @Override
    protected void authenticate() throws IOException, XMPPException
    {

        getSASLAuthentication().send(new AuthMechanism(NAME, ""));
    }

    @Override
    public void authenticate(String apiKeyAndSessionKey, String host,
            String applicationSecret) throws IOException, XMPPException
    {
        if (apiKeyAndSessionKey == null || applicationSecret == null)
        {
            throw new …
Run Code Online (Sandbox Code Playgroud)

java android facebook xmpp smack

10
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

facebook ×1

java ×1

smack ×1

xmpp ×1