Android Secret Code (input character pop-up Mobile information) detailed _android

Source: Internet
Author: User

Android Secret Code

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

To implement your own secret code, you only need to register a broadcast Receiver with the system without any permissions, as follows:

<receiver android:name= ". Secretreceiver ">
  <intent-filter>
    <action android:name=" android.provider.Telephony.SECRET_ CODE "/>
    <data android:scheme=" Android_secret_code android:host= "0123"/>
  </intent-filter>
</receiver>

You only need to register the action as Android.provider.Telephony.SECRET_CODEand scheme is Android_secret_code broadcast Receiver, so when the user in the dial-up keyboard input *#* #0123 #*#* will call our registered Receiver, in Receiver the received intent information will be the case:

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

This logic is handled in dial-up applications and may fail if the application is not processed using a third-party dial-up application.

So what does this feature have to do with it? This depends on the application, because the broadcast receiver is running in your own application process, so you can read all the data in your application. For example, you can open an activity to make some special settings after receiving the broadcast, and you can enable/disable some features (such as flyme can display some of the accessibility features in the settings after you enter the *#* #6961 #*#* can open root, etc.).

However, different receiver can register the same android:host, may conflict with other application settings, but in general the application should not use this function, the control of the system-level application or put it in the application is better.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.