简体   繁体   中英

Programmatically Send SMS without it showing in Messaging App

Is there a way to programmatically send sms messages without them showing in the Messaging app? I am using the following code to send SMS:

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

And the messages are showing in the default Messaging app aswell as Google Hangouts. For my application it would be ideal for the messages not to show up, as they are simply sending code to a GSM module, and they just fill up the users Messaging app.

If you aren't sending real texts, you should probably send a port based SMS which won't be added to the messaging DB. But if you can't, you need to delete it from the sms content resolver.

ctx.getContentResolver().delete(Uri.parse("content://sms/inbox"), {"body"}, messageBodyToDelete);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM