如何从Android应用程序,而不使得其记录设备的SMS视图发送短信? [英] How to send SMS from the Android app without making its record in device SMS view?

查看:445
本文介绍了如何从Android应用程序,而不使得其记录设备的SMS视图发送短信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的Andr​​oid应用程序发送短信。但我不希望它的记录被存在于设备的信息视图。我目前使用下面code。

I want to send an SMS from my android app. But I don't want its record to be exist in device message view. I am currently using below code.

sendSMS(etsendernumber.getText().toString(), etmessagebody.getText().toString()); 
sendintent = new Intent(Intent.ACTION_VIEW);
sendintent.putExtra("sms_body","");
sendintent.setType("vnd.android-dir/mms-sms");
startActivity(sendintent);

但它正在发送短信记录在设备的消息图。我们可以把从Android应用程序秘密的短信?

But it is making sent sms record in message view of the device. Can we send a secret sms from android application?

请咨询。

推荐答案

是的,您要发送短信的方式是使用附带消息应用程序。因此,它会永远记录发送的消息。您必须使用SmsManager的发送短信。

Yes, the way you are trying to send SMS is by using the shipped messaging application. So it will always record the sent messages. You must use SmsManager to send the SMS.

SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phoneNumber, null, message, null, null);

在这种方式,您的SMS不会被插入到列表

In this way, your SMS wont be inserted into the list.

还记得添加这个在你的清单

Also remember to add this in your manifest

<uses-permission android:name="android.permission.SEND_SMS" />

这篇关于如何从Android应用程序,而不使得其记录设备的SMS视图发送短信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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