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.