Android blacklist Interception

Source: Internet
Author: User

Android does not open an API for ending a call. to end a call, you must use AIDL to communicate with the telephone management service and call the API in the service to end the call. The method is as follows: 1> copy the following file from the Android source code to the project: com. android. internal. ITelephony under the telephony package. aidl (corresponding to the \ base \ telephony \ java \ com \ Android \ internal \ telephony directory under the android version source code directory) android. neighboringCellInfo In the telephony package. aidl Note: You need to create a corresponding package name in the project to store the above two aidl files. 2> call ITelephony. end call (): Method method = Class. forName ("android. OS. serviceManager "). getMethod ("GetService", String. class); www.2cto.com IBinder binder = (IBinder) method. invoke (null, new Object [] {TELEPHONY_SERVICE}); ITelephony telephony = ITelephony. stub. asInterface (binder); telephony. endCall (); 3> the above is only one of the usage of ITelephony. It can be used to implement the phone blacklist function-Listen to the phone call status and determine if the phone number is a blacklist number, that is, the phone is hung up as shown above. In addition, there are many other practical methods. For example, the call method can be used to directly call a phone and obtain the call status. I have not studied this method in depth. Add the permission to the AndroidManifest. xml file: <uses-permission android: name = "android. permission. CALL_PHONE"/>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.