Development of phone interception and interception prompt sound function based on Android

The content of this article is how to write a program for telephone interception in Android system and send an interception prompt tone to remind users. It can be said that this function is still practical.

1. Telephone interception

As you may know, this function is realized by calling itelephony's hidden method based on the reflection principle.

2. Prompt busy tone / empty number / shutdown / shutdown after interception

This function actually uses MMI instructions. For details on how to set call forwarding, please refer to here http://baike.baidu.com/view/206402.html?fromTaglist 。

In this article, we will use the "busy transfer" function. The setting method of China Mobile is * * 67# phone number #, and the cancellation method is ##67#. " Unconditional transfer "use 21 instead of 67. These two commands can be directly entered in the dialing interface of the mobile phone and dialed for test. Itelephony's endcall method will prompt that the phone is busy after hanging up. If the busy time is set in advance, you will be prompted that the dialed phone number is empty / powered off / powered off.

In fact, you can download XXX guard. After setting the incoming call rejection mode, it will start the interface for setting MMI instructions. Then go to "Settings - > call settings - > incoming call transfer" and look at the phone number set in "transfer on busy line" to know what the corresponding phone number is for empty number / turned off / turned off.

1. Modify blocked_ Number this variable value, set it to the phone number you want to test interception.

2. All functions are implemented in an activity, so you should run the activity first, and then click "set call forwarding". After setting call forwarding, don't close the activity. If you close it, you can't intercept calls. Interested friends can write a service and run the interception function in the background.

Implementation method 1:

The code is as follows:

AndroidManifest. The XML is as follows:

Implementation mode 2:

1. Build package Android refuseCalling。

refuseCalling. The Java code is as follows:

2. Build package Android telephony。

NeighboringCellInfo. The Aidl code is as follows:

package android. telephony;

3. Build package com android. internal. telephony。

ITelephony. The Aidl code is as follows:

4、AndroidManifest. The XML code is as follows:

I hope this article can help friends who develop Android phone applications. Thank you for your support!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>