I am implementing
SMSListener
in my app and I have set it's possibly highest priority asandroid:priority="2147483647"
so that I should get the call on new incoming sms.- 开发者_Python百科
In my second sample app I have set the same priority as above for
SMSListener
but when I get call for new incoming SMS I am usingabortBroadcast();
.
When I ran both these app and I found that 1
is getting the call before 2
. Now I am seeking this behaviour will remain as it is or it is not constant and 2
can get call before 1
.
I want to make sure that my app get's the call whenever sms comes even if there exists some other app which has the highest priority and it is aborting the sms.
I hope I have put my point and looking for some convincing answer.
Thanks for devoting your time to my problem.
The abortBroadcast only works when they get it first, usually based on installation order, but not always.) System level apps will execute, then Android will try to sort out non-system apps. If you look at the source code, the order of execution is based on priority level, but the calls to select the order of apps is not consistent for apps over 999 or for apps with the same priority level. It might be in order of installation, but system changes can result in other orders of execution (which I have seen many times with testing this).
Another thing, from what I understand, the priority for applications must be between -1000 and 1000, inclusive.
http://developer.android.com/reference/android/content/IntentFilter.html#setPriority%28int%29
http://developer.android.com/reference/android/content/IntentFilter.html#SYSTEM_HIGH_PRIORITY
精彩评论