Secret Code under Android programming

Source: Internet
Author: User

Many of us should have done this, open the dial pad input *#* #4636 #*#* and other characters will pop up an interface to display some information about the phone, this feature is called Android Secret Code in Android , in addition to these system presets Secret code, we can also implement their own Secret code, and implementation is very simple.

To implement your own Secret Code, simply register a broadcast Receiver with the system and do not require any permissions, as follows:

<receiverAndroid:name=". Secretreceiver ">    <Intent-filter>        <ActionAndroid:name= "Android.provider.Telephony.SECRET_CODE"/>        <DataAndroid:scheme= "Android_secret_code"Android:host= "0123"/>    </Intent-filter></receiver>

Only need to register action as Android.provider.Telephony.SECRET_CODE, and scheme is Android_secret_code broadcast Receiver, so that when the user enters *#* #0123 #*#* on the dial keypad, it calls our registered receiver, and the received Intent message is typed in receiver:

    • Intent {act=android.provider.telephony.secret_code dat=android_secret_code://0123 flg=0x10 cmp= me.angeldevil.secretcode/. Secretreceiver}

This logic is handled in a dial-up application, and if a third-party dialing application is used and the application is not processed, it may fail.

So what's the use of this feature? This depends on the application, as this broadcast Receiver runs within your own application process, so you can read all the data in your app. For example, you can receive the broadcast after the dump application status, you can open an Activity to do some special settings, you can enable/disable some features (such as Flyme can be entered *#* #6961 #*#* after the settings to display some of the accessibility features, you can open the Root , etc.). However, different Receiver can register the same android:host, may conflict with other application settings, but generally the application should not use this function, non-system-level application control or put in the application is better.

Secret Code under Android programming

Related Article

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.