Send SMS, but don't show it in sent messages

I want to hide my sent items when I send sms from my app or don't register it at all.

Here is the code I'm here:

SmsManager smsManager = SmsManager.getDefault();
PendingIntent piSent = PendingIntent.getBroadcast(contextUpdate, 0, new Intent("SMS_SENT"), 0);
PendingIntent piDelivered = PendingIntent.getBroadcast(contextUpdate, 0, new Intent("SMS_DELIVERED"), 0);
smsManager.sendTextMessage(alarmNumber, null, alarmCode + " " + sentDisarmCode + " OFF", piSent, piDelivered);


If I'm not mistaken, to skip saving sent sms, I must write null to piSent

and piDelivered

. But I need these 2 broadcasts, so I know if my messaging was sent in the toast message I have and see if it was delivered.

Is there anything else I should try?


source to share

1 answer

You seem to be dealing with KitKat or higher, as before, any application sending SMS using SmsManager

would have to explicitly write messages to the provider in order for them to appear in any other application. In this case, your application must be a standard SMS application to "hide" sent messages. Starting with KitKat, any application that is not standard and uses methods SmsManager

for sending messages has those messages that are automatically recorded by the Supplier's system. PendingIntents are only used to confirm Sent and Delivered and have nothing to do with writing messages.

On the other hand, the default SMS application is responsible for recording all its own outgoing messages. For him, no automatic entries are made, and they can refuse them. You can consult the following link for information on how to make the application suitable for use as the default SMS application.

Getting your SMS apps for KitKat



All Articles