如何使用url方案向Facebook Messenger发送消息? [英] how to send a message to facebook messenger using url scheme?

查看:474
本文介绍了如何使用url方案向Facebook Messenger发送消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用url方案将消息发送到Facebook Messenger?搜索方案后,我发现Messenger使用fb://messaging/打开,有人知道如何附加消息吗(不附加特定的userId)

Is it possible to send a message to the facebook messenger using url scheme? after searching for schemes I found that messenger opens using fb://messaging/ does anybody know how to attach a message?(without attaching specific userId)

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

ex: twitter://post?message=hello

推荐答案

您应该尝试

    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");
    }

它将打开Facebook Messenger应用,选择一个朋友,然后消息将被发送.

It will open Facebook Messenger app, select a friend and the message will be send.

这篇关于如何使用url方案向Facebook Messenger发送消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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