"Android Notes" launches a secret interface by dialing a specified number in the Dial-up interface

Source: Internet
Author: User

Program Description:1. By registering the broadcast receiver to listen to the user to call the operation; 2. When the user dials the phone, the broadcast recipient receives the number and, in contrast to the specified "password", launches an interface and terminates the user's call operation if it matches.
implementation:

1. Configure the broadcast recipient in the manifest file and add the permissions:

<receiver             android:name= "Cn.edu.chd.mobilesafe.receiver.CallPhoneReceiver"            >            < Intent-filter                 android:priority= "                >                <action android:name=" android.intent.action.NEW_ Outgoing_call "/>            </intent-filter>        </receiver>  

Permissions:


2. Processing in the broadcast recipient OnReceive method:

public class Callphonereceiver extends broadcastreceiver{    private static final String CODE = "";    @Override public    void OnReceive (context context, Intent Intent)    {        String number = Getresultdata ();        if (code.equals (number))        {            Intent myintent = new Intent (context,demoactivity.class);            Myintent.addflags (intent.flag_activity_new_task);            Context.startactivity (myintent);            Terminating outgoing calls            setresultdata (null);}        }      


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.