![sms inbox app sms inbox app](https://i1.wp.com/truecaller.blog/wp-content/uploads/2017/07/spam-inbox.png)
Now the way the Android SMS incoming routing works is that the piece of code responsible for decoding the messages sends a Broadcast (it uses the sendBroadcast() method – which unfortunately is NOT the version that lets you simply call abortBroadcast()) whenever a message arrives. I have a receiver that picks up on incoming SMS messages. Unfortunately it’s not all plain sailing ? So, I had a play, and it is possible to delete a received SMS. So, DO NOT put that RECEIVE_SMS permission attribute in your intent! Hopefully someone wiser than me can tell me why that was the case. When I had those settings, android gave me some crazy permissions exceptions that didn’t allow android.phone to hand off the received SMS to my intent. Note the receiver tag does not look like this: When trying the delete on sms/inbox/ or sms/all/, you will probably get: : Unknown URLĪt .lete(SmsProvider.java:510)Īt $lete(ContentProvider.java:149)Īt (ContentProviderNative.java:149)įor additional reference too, make sure to put this into your manifest for your intent receiver: Looks like the thread takes precedence, which makes sense, but the error message only emboldened me to be angrier. Note: I wasn’t able to do a delete on content://sms/inbox/ or content://sms/all/ GetContentResolver().delete(Uri.parse("content://sms/conversations/" + thread_id),null,null) Int thread_id = c.getInt(1) //get the thread_id In our Activity: Uri uriSms = Uri.parse("content://sms/inbox") Ĭursor c = getContentResolver().query(uriSms, null,null,null,null)
![sms inbox app sms inbox app](https://www.researchgate.net/profile/Chinedu-Nwoye-3/publication/303985300/figure/fig1/AS:373269921320960@1466005892657/Software-Architecture-of-Message-Protector-App_Q320.jpg)
Our flow will probably need to then listen for the message, capture for the message we want, do a query to get the thread_id of the recently inbounded message and do the delete() call. It’s not perfect, since i need to delete the entire conversation, but for our purposes, it’s a sufficient compromise as we will at least know all messages will be looked at and verified. Using suggestions from others, I think I got it to work: