Joke Collection Website - Public benefit messages - Can SMS interception stop strange calls?

Can SMS interception stop strange calls?

Yes, you can.

As long as there is a signal when the phone is turned on, you can receive the other party's information. When it is set to call rejection or blacklist, if the other party sends a short message, the mobile phone can still receive the short message. SMS is stored in your mobile phone blacklist or call rejection record, which includes not only the call rejection record, but also the SMS interception record.

SMS interception is actually a relatively simple one. There are many related introductions on the Internet. Here, I mainly introduce some problems encountered in the writing process.

First of all, the principle of SMS interception is to monitor the broadcast of SMS, and then judge the number of SMS and whether it is blacklisted. If so, the broadcast transmission is ended by broadcasting. Among them, the most important problem in the process of doing this is not to receive the interception, but to receive the interception first, because the short message broadcast is orderly broadcast, so whoever receives the broadcast first can have the right to end the transmission of the broadcast, so we must actually find ways to raise our permission to receive the broadcast to the highest level. There are two main methods here, 1 is to set the maximum weight limit, and 2 is to set the registration method as dynamic registration.

Setting the maximum permissions actually means setting the highest priority when registering for broadcasting. The api of Android system states that the maximum permission is 1000, but in fact it receives an int value, and the system has no online judgment value, so we can set the maximum value of int, and this permission is the highest.

Then, if they are all the maximum permissions and whose priority is higher, it is the second point, dynamic registration monitoring. Because the broadcast registered dynamically in the source code is put into the monitoring list before the static broadcast, we use dynamic registration to set up monitoring here.

Then if everyone uses dynamic registration, who will receive it first? This place seems to be related to the package name of the application. I don't quite understand. The earlier the installation time, the higher the priority, and the higher the alias order of software package names in the system (not the alphabetical order of software package names written by us).

Then let's look at the concrete implementation. First, build a service, and then ensure that the service always runs in the background (it can always exist through daemons, listening to boot broadcasts, etc.). ), and then register the broadcast and deregister it in the onStartCommand and onDestroy methods of the service respectively.