How Android intercepts dialing

Source: Internet
Author: User

After the user enters the number in the system's dial-up application and presses the dial-up key, I want to perform some operations before the user actually dials out. For example, modify the number or check the permission.

I think the system's dial-up action should still send an intent, which can be intercepted theoretically. Finally, I saw the method in the open-source project sipua. As follows:

First, take a closer look at the description of intent. action_new_outgoing_call In the API. The excerpt contains "you must hold the process_outgoing_cils permission to receive this intent. This is a protected intent that can only be sent by the system ".

The system dialing action actually sends a broadcast Action containing such an intent. We can write a receiver to obtain this intent. For example, in sipua:

JavaCode:

<Cycler Android: Name = ". UI. Caller"><Intent-filter Android: Priority = "-1">
<Action Android: Name = "android. Intent. Action. new_outgoing_call"/></Intent-filter></Cycler>

Note that Android: Priority = "-1" needs to be set in this way to capture this intent. For details, refer to the instructions in the API. Of course, pay attention to

Java code:

<Uses-Permission Android: Name = "android. Permission. process_outgoing_cils"> </uses-Permission>

Http://www.eoeandroid.com/thread-100615-1-1.html.

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.