Android-Java-意图发送Facebook聊天消息(已禁用Facebook XMPP) [英] Android - Java - Intent to send facebook chat message (facebook disabled xmpp)

查看:91
本文介绍了Android-Java-意图发送Facebook聊天消息(已禁用Facebook XMPP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

*** Facebook不推荐使用xmpp api.

***Facebook deprecated xmpp api.

是否有一种方法可以打开意图(或将数据传递给fb)以在Android设备上发送聊天消息? 脸谱网设备上安装的Messenger应用.

Is there a way to open an intent (or pass data to fb) to send chat message on android device? Facebook & Messenger apps installed on the device.

谢谢:-)

推荐答案

您需要将uri传递给意图 在这里 100005727832736 是您想要的人的用户ID 消息

You need to pass uri to the intent Here 100005727832736 is the user id of the person who you want to message to

Uri uri = Uri.parse("fb-messenger://user/100005727832736");

这是我的示例代码

Uri uri = Uri.parse("fb-messenger://user/100005727832736");

Intent toMessenger= new Intent(Intent.ACTION_VIEW, uri);
try {
        startActivity(toMessenger);
    } 
catch (android.content.ActivityNotFoundException ex) 
    {
        Toast.makeText(context, "Please Install Facebook Messenger",    Toast.LENGTH_LONG).show();
}
}

这对我有用,我一段时间未测试.

这篇关于Android-Java-意图发送Facebook聊天消息(已禁用Facebook XMPP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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