分享与Facebook Messenger中的文字? [英] Share a text with facebook messenger?

查看:595
本文介绍了分享与Facebook Messenger中的文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用机器人来分享到Facebook Messenger中的文字,也许Facebook的SDK中呢?

Is there a way to share a text in facebook messenger using android and maybe facebook sdk as well?

我想要的东西,如WhatsApp的方式,选择你的文字,打开的意图,选择要发送的家伙... 有没有一种方法来与Facebook Messenger的做到这一点? 它出现在intent.choose dialog..but我只想发送到Facebook的使者。

I want to make something like the whatsapp way, choose your text and open an intent to choose the guy you want to send to... Is there a way to do this with facebook messenger? It appears in the intent.choose dialog..but I only want to send to facebook messenger..

推荐答案

使用code的onClick ,,

use this code onClick,,

com.facebook.orca是FB信使包名称。

com.facebook.orca is the package name for fb messenger.

    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent
            .putExtra(Intent.EXTRA_TEXT,
                    "<---YOUR TEXT HERE--->.");
    sendIntent.setType("text/plain");
    sendIntent.setPackage("com.facebook.orca");
try
{
    startActivity(sendIntent);
}
catch (android.content.ActivityNotFoundException ex) 
{
    ToastHelper.MakeShortText("Please Install Facebook Messenger");
}

编辑:

2015年开始五月初使者不再是自己注册为共享意向目标。直到它的变化,code以上将无法正常工作。

Beginning early May 2015 Messenger no longer register itself as share intent target. Until it changes, code above won't work.

这篇关于分享与Facebook Messenger中的文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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