问题
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