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