Abort SMS Intent on Android KitKat

半世苍凉 提交于 2019-11-27 23:54:32

问题


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.


回答1:


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).




回答2:


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

  • https://code.google.com/p/android/issues/detail?id=61684
  • http://android-developers.blogspot.co.uk/2013/10/getting-your-sms-apps-ready-for-kitkat.html



回答3:


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.



来源:https://stackoverflow.com/questions/20109450/abort-sms-intent-on-android-kitkat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!