简体   繁体   English

如何使用URL方案向Facebook Messenger发送消息?

[英]how to send a message to facebook messenger using url scheme?

Is it possible to send a message to the facebook messenger using url scheme? 是否可以使用url方案向Facebook Messenger发送消息? after searching for schemes I found that messenger opens using fb://messaging/ does anybody know how to attach a message?(without attaching specific userId) 搜索方案后,我发现Messenger使用fb:// messaging /打开,有人知道如何附加消息吗(不附加特定的userId)。

ex: twitter://post?message=hello 例如:twitter:// post?message = hello

you should try this 你应该试试这个

    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, "Your message");
    sendIntent.setType("text/plain");
    sendIntent.setPackage("com.facebook.orca");

    try {
        startActivity(sendIntent);
    } catch (android.content.ActivityNotFoundException ex) {
        ToastHelper.show(this, "Please Install Facebook Messenger");
    }

It will open Facebook Messenger app, select a friend and the message will be send. 它将打开Facebook Messenger应用,选择一个朋友,然后将发送消息。

我认为这是不可能的-毕竟,消息始终必须是100%用户生成的,因此附加任何消息都没有任何意义。

您可以使用fb-messenger://share?link=fb-messenger://share?text=

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM