如何使我的SMS应用程序成为接收广播接收器的最高优先级 [英] How to make my SMS App is highest Priority to receive Broadcast Receiver

查看:139
本文介绍了如何使我的SMS应用程序成为接收广播接收器的最高优先级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,对不起,我的英语还不够好!

我的问题是我正在编写一个阻止短信应用程序,我想通过我的应用程序接收短信,然后中止广播以使默认短信应用程序无法接收短信,因此我将我的应用设置为最高优先级(1000) ,但我的应用在android的默认短信应用后仍能接收广播.

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.

当我的手机接收到SMS时,我会按顺序打印所有Android Phone SMS的广播接收信号,并且我认识到System SMS App始终会首先接收SMS广播,并且它也具有最高优先级.

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.

那么我该如何使我的短信应用在系统的默认SMS之前可以接收SMS广播?

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

我真的很需要您的帮助!

I am really needed your help !

感谢您的阅读!

推荐答案

如google所述,广播接收器的最大优先级小于1000,最高为999. 但是,您可以将其设置为最高级别2147483647.由于Google Play上的其他应用使用的优先级(大于999)高于广播接收器,因此,您的应用可能无法接收短信.在此最大级别下,您的应用将始终始终首先接收SMS. 这样一来,您就可以在默认消息传递应用程序之前进行广播了.

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.

请参见答案!

这篇关于如何使我的SMS应用程序成为接收广播接收器的最高优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆