Vahid Vaezinia
Vahid Vaezinia

Reputation: 191

How can I send SMS without save in inbox or sent folders - Android

How can I send sms without save in inbox or sent folders in android?

when I using this code, the message save in sent folder:

SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumber, null, messageBody, null, null);

but I want to send message in background.

Upvotes: 2

Views: 1986

Answers (1)

Hon
Hon

Reputation: 110

Is your app running in android 4.4 and above?

Starting from Android 4.4, you cannot send the sms without showing in the sentbox.

Outlined at https://developer.android.com/about/versions/android-4.4.html#SMS you can see the changes.

SMS Provider The Telephony content provider (the "SMS Provider") allows apps to read and write SMS and MMS messages on the device. It includes tables for SMS and MMS messages received, drafted, sent, pending, and more.

Beginning with Android 4.4, the system settings allow users to select a "default SMS app." Once selected, only the default SMS app is able to write to the SMS Provider and only the default SMS app receives the SMS_DELIVER_ACTION broadcast when the user receives an SMS or the WAP_PUSH_DELIVER_ACTION broadcast when the user receives an MMS. The default SMS app is responsible for writing details to the SMS Provider when it receives or sends a new message.

Other apps that are not selected as the default SMS app can only read the SMS Provider, but may also be notified when a new SMS arrives by listening for the SMS_RECEIVED_ACTION broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This broadcast is intended for apps that---while not selected as the default SMS app---need to read special incoming messages such as to perform phone number verification.

For more information, read the blog post, Getting Your SMS Apps Ready for KitKat.http://android-developers.blogspot.my/2013/10/getting-your-sms-apps-ready-for-kitkat.html

Upvotes: 3

Related Questions