(Source code introduction
Let's start with the following points: 1. As we all know, the function of telephone interception is realized by calling the hidden method of itelephony based on the reflection principle. I won't say this, but attach the code. 2. The function of prompting busy tone / empty number / shutdown / shutdown after interception is actually to use MMI commands. We will use "busy forwarding" to specify how to set call forwarding. Conversion function. The setting method of China Mobile is * * 67 \phonenumber\and the cancellation method is \67\. These two commands can be directly input in the mobile phone dialing interface for testing. After the itelephony endcall method hangs up the phone, it will prompt that the phone is busy. If the busy hour transfer empty / off / off phone number is set in advance, you will be prompted to dial an empty / off / off phone number. In fact, you can download XXX guard to have a look. After setting the call rejection mode, the interface for setting MMI commands will be started. Then go to settings & Gt; & call settings; Gt; "Call forwarding", check the phone number set in "busy time forwarding", and then you can know that the corresponding phone number is empty / off / off. Attached is the demonstration project file. There are several points to be explained: 1 Modify variable blocked_ The value of number is set to the phone number you want to test for interception. 2. all functions are implemented in one activity, so you should run the activity first, and then click "set call forwarding". After setting the incoming call forwarding, do not close the activity, and you will not be able to intercept incoming calls. Interested friends can write a service to run the interception function in the background. It has been modified to the version that can intercept SMS. I hope it is useful to you.)