Basic principle: After the Android system clicks the dial-up key, a broadcast is sent, and the action is intent. action_new_outgoing_call. we write our own reciver to accept this broadcast and retrieve the dial-up number from the intent for the purpose...
First, we register reciver statically.
<Cycler Android: Name = ". caller "> <intent-filter Android: Priority ="-1 "> <action Android: Name =" android. intent. action. new_outgoing_call "/> </intent-filter> </Cycler>
Then we write the acceptance method:
Public class caller extends broadcastreceiver {string tag = "Caller"; @ overridepublic void onreceive (context, intent) {// todo auto-generated method stublog. I (TAG, "Receive message"); If (intent. getaction (). equals (intent. action_new_outgoing_call) {set <string> set = intent. getextras (). keyset (); iterator <string> it = set. iterator (); log. I (TAG, intent. getstringextra ("android. intent. extra. phone_number "));}}}
Numbers can be printed ..