Android dial cipher to start the app

Source: Internet
Author: User

Recently, wrote a small application of information about equipment, requirements in the launcher is not obvious, through the dial-up keyboard cipher to start the application. The following notes are available:

Software platform: Android4.4.3

First, you want to register to receive Android cipher broadcasts in Androidmanifest.xml.

        <span style= "FONT-SIZE:18PX;" ><receiver android:name= "Infosecretcode" >            <intent-filter>                <action android:name= " Android.provider.Telephony.SECRET_CODE "/>                <data                    android:host=" 668866 "                    android:scheme=" Android_secret_code "/>            </intent-filter>        </receiver></span>

Secondly, we need to instantiate the processing of the received broadcast event, named Infosecretcode.java, the code is as follows:

<span style= "FONT-SIZE:18PX;" >import Android.content.context;import Android.content.intent;import Android.content.broadcastreceiver;import Android.util.config;import Android.util.log;import Android.view.keyevent;public class InfoSecretCode extends Broadcastreceiver {    private final String secret_code_action = "Android.provider.Telephony.SECRET_CODE";     Public Infosecretcode () {    }    @Override      the public void onreceive (context context, Intent Intent) {        if ( Intent.getaction (). Equals (Secret_code_action)) {            Intent i = new intent (intent.action_main);            I.setclass (context, infoactivity.class);            I.setflags (intent.flag_activity_new_task);            Context.startactivity (i);}}    } </span>

so, in the dial-up keyboard input "*#* #668866 #*#*" can pop up infoactivity, specific activity to add themselves.



Android dial cipher to start the app

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.