Before Android KitKat, it was possible to send SMS messages without them being stored in the sent folder of the installed messaging apps on the device, using this method:
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage(phonenumber, null, message, null, null);
But how is it done post-KitKat? Do you have to delete the messages that are sent out by your app? And if so, how is it done correctly?
Starting with KitKat, any app with the SEND_SMS
permission is able to send messages with the standard SmsManager
methods, and the system will handle writing the messages to the Provider automatically. As the default app is the only one with write access to the Provider, it is the only one that can delete messages, so any non-default app won't be able to delete those messages written automatically.* If you don't want them to be written, your app should be set as the default SMS app. The default app is responsible for writing its own outgoing messages, and it can opt not to do so.
* A possible workaround for the write access restriction in Android 4.4 (KitKat) can be found in the answer here.
来源:https://stackoverflow.com/questions/25247303/android-delete-sms-messages-in-sent-box