Abort SMS Intent on Android KitKat
Asked Answered
D

3

10

I'm currently developing an application that needs to deal with SMS only if it is an SMS expected by the application (same behaviour as Whatsapp on registration).

I would like to abort the SMS Intent as it is not expected to appear in the SMS box.

My question is : I know that Google changed a lot about SMS behaviour in KitKat, and now, even if my SMS is well parsed by my application, the SMS also appear in SMSBox, even if I call this.abortBroadcast(); in my SMS broadcast receiver. So is there a way to avoid those SMS appearing in SMS box without having to develop a complete SMS application ?

For information, the priority is yet to 1000 (and I tried also with MAX Integer) in Manifest file for this Broadcast Receiver.

Danny answered 20/11, 2013 at 23:35 Comment(4)
"So is there a way to avoid those SMS appearing in SMS box without having to develop a complete SMS application ?" -- AFAIK, no. I would structure the SMS to be valuable to the user, in addition to serving your desired role, to justify it being in the inbox (and being worth whatever the user paid for the message, if anything).Kippy
In the context of my application, I can not make it valuable for the user without increasing it size to more than 1 SMS. It's why I'm currently curious about a solution if one exists. Btw, thanks for your answer.Danny
What if to change default SMS app in Wireless & networks settings?Granular
Yes, I just spent the last couple hours trying to figure out why my app wasn't aborting broadcast, and then I realized I was using my API 19 emulator!Carcajou
F
9

Hangouts uses the maximum possible priority (999 per the Intent-Filter docs) and therefore you cannot abort it on <4.4 releases. On 4.4+, only the default SMS app (blog post with details) can make changes to the SMS Provider (i.e., automatically delete the SMS).

Fructification answered 20/11, 2013 at 23:55 Comment(1)
I would mention that in the case that your app is the default SMS app, it is responsible for writing incoming messages to the Provider, so it would be a matter of omitting those writes, rather than deleting messages from the Provider. Also, for further information regarding Hangouts, please see this answer: #25355016Carden
C
3

You can't stop a message from showing in Default SMS application in kitkat. Checkout following links for details:

Citystate answered 27/12, 2013 at 19:38 Comment(0)
E
-1

You can block SMS on Android 4.4 - 4.4.4 using

1)

  • Using AppsOpps setting
  • WRITE_SMS permission

Sms will be deleted in 10 seconds with notification about this sms.

As option you can block sound on receiving unwanted sms.

2) Set up your app as default sms app.

Experimentalism answered 19/3, 2016 at 20:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.