如何从我的Andr​​oid应用程序使用WhatsApp的? [英] How to use whatsapp from my Android app?

查看:119
本文介绍了如何从我的Andr​​oid应用程序使用WhatsApp的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我如何调用该SMS应用程序:

This is how I am calling the SMS app:

Intent sendIntent = new Intent(Intent.ACTION_VIEW);
            sendIntent.putExtra("sms_body", "The SMS text"); 
            sendIntent.setType("vnd.android-dir/mms-sms");

            startActivity(sendIntent);   

我如何做同样通过微博/ WhatsApp的/ Facebook的发送邮件?我应该怎么写代替MMS短信?我没有发现任何文件上这样的。

How do I do the same for sending messages via twitter/Whatsapp/Facebook? What should I write in place of mms-sms? I found no documentation on such.

推荐答案

我也无法找到任何方式直接调用的Facebook / Twitter的,但你可以随时拨打 android.content.Intent.ACTION_SEND 键,让用户选择的应用程序。

I can't also find any way of calling Facebook/Twitter directly, but you could always call android.content.Intent.ACTION_SEND and let the user choose the application.

Intent i = new Intent(android.content.Intent.ACTION_SEND);

i.setType("text/plain");
i.putExtra(Intent.EXTRA_SUBJECT, "Subject");
i.putExtra(Intent.EXTRA_TEXT, "Message body");

startActivity(Intent.createChooser(i, "Share dialog title"));

然而,在使用这种通过Facebook来分享有可能是一个错误。欲了解更多信息,请参阅: Android的Facebook的意图

这篇关于如何从我的Andr​​oid应用程序使用WhatsApp的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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