How to make my SMS App is highest Priority to receive Broadcast Receiver

只愿长相守 提交于 2019-12-02 17:07:30

问题


At First, I am sorry for my English is not good enough !

My problem is i am writting a Block SMS Application and i want to receive sms with my app and then i abort broadcast to make default sms app can't receive SMS, so i set my app have a highest priority (1000), but my app still receive broadcast after default sms app of android.

I print all of my Android Phone SMS's broadcast received signal in order when my phone receive a SMS and i recognize that The System SMS App alway receive SMS Broadcast first and it also have Highest priority.

So how can i make my sms app could receive SMS Broadcast before Default SMS of system ?

I am really needed your help !

Thank for your reading !


回答1:


As documented by google, the maximum priority for a broadcast receiver is less than 1000, litteraly 999. But you can set it to a maximum level of 2147483647. As other apps on Google Play uses higher priority (more than 999) than your Broadcast recevier, due to this your app may not receive the SMS. By this maximum level, your app will always receive the SMS first. So this way you can get broadcast before the default messaging app.

See this answer!



来源:https://stackoverflow.com/questions/18940286/how-to-make-my-sms-app-is-highest-priority-to-receive-broadcast-receiver

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