Android的:如何以编程方式通过使用最新的应用程序发送的消息,我们聊天吗?应用程序、消息、方式、最新

2023-09-04 03:53:14 作者:藏不住喜歡

不幸的是我无法找到任何想法如何使用的WhatsApp 和微信 ??

Unfortunately I have unable to found any idea how to use messaging in android application by using WhatsApp and WeChat ??

其实要求是发送使用什么应用程序,短信和我们聊天(免费短信)。因此,可以有人帮助我,分享一些知识如何做到这一点?任何想法或任何教程?

Actually requirement is to send sms using whats app and we chat ( Free sms ). So can someone helps me and shares some knowledge that how to do this ? Any Idea Or Any Tutorial ?

感谢

推荐答案

我得到了解决。这里我张贴的答案,以便它可以帮助谁可能有同样的怀疑别人。

I got the Solution.. Here I am posting the answer so that it may help other people who may have same doubt..

有关分享,通过任何应用程序...

For Share through any application...

 public void sendAppMsg(View view) {

    Intent intent = new Intent(Intent.ACTION_SEND);
    intent .setType("text/plain");
            String text = " message you want to share..";

//变化所需的应用程序包

// change with required application package

    intent .setPackage("PACKAGE NAME OF THE APPLICATION");
    if (intent != null) {
        intent .putExtra(Intent.EXTRA_TEXT, text);//
        startActivity(Intent.createChooser(intent  , text));
    } else {

        Toast.makeText(this, "App not found", Toast.LENGTH_SHORT)
                .show();
    }

}

注:更改 *应用程序按照您的要求与包名称一样

Note : change *PACKAGE NAME OF THE APPLICATION as per your requirement like

例子:使用

// WhatsApp的

//Whatsapp

intent.setPackage(com.whatsapp);

// LinkedIn

//Linkedin

intent.setPackage("com.linkedin.android");

//微博

 intent.setPackage("com.twitter.android");

// Facebook的

//Facebook

 intent.setPackage("com.facebook.katana");

// GooglePlus

//GooglePlus

intent.setPackage("com.google.android.apps.plus");