从Android应用程序发送SMS消息,而无需打开选择器? [英] Sending a SMS Message from an Android Application without opening chooser?

查看:210
本文介绍了从Android应用程序发送SMS消息,而无需打开选择器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序通过使用以下code我已经实现发送短信。

In my android application I have implemented sending SMS by using below code.

   Intent smsIntent = new Intent(Intent.ACTION_VIEW);

    smsIntent.putExtra("sms_body", "Hello World!"); 
    smsIntent.putExtra("address", "0123456789");
    smsIntent.setType("vnd.android-dir/mms-sms");

    startActivity(smsIntent);

我的问题是,如果我有设备上的多个SMS应用,它打开选择器来选择发送方应用程序。我不希望要打开的选择器;我想从Android的原生应用程序,短信发送,无需打开选择器。因此,任何有助于实现这一目标将是AP preciated。

My problem is that if I have more than one SMS application on the device, it opens the chooser to choose the sender application. I don't want the chooser to be opened; I want to send from Android's native SMS app without opening the chooser. So any help to achieve this will be appreciated.

推荐答案

使用的短信管理器?

http://developer.android.com/reference/android/telephony/ SmsManager.html

void    sendTextMessage(String destinationAddress, String scAddress, String text, PendingIntent sentIntent, PendingIntent deliveryIntent)

发送一个基于文本的短信。

Send a text based SMS.

这篇关于从Android应用程序发送SMS消息,而无需打开选择器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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