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 our own secret code, and the 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:
<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>
only need to register action as Android.provider.Telephony.SECRET_CODE, and scheme is Android_secret_code broadcast Receiver, This will call our registered receiver when the user enters *#* #0123 #*#* on the dial pad, and the received intent message will be 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 functions (such as flyme can be input *#* #6961 #*#* after the settings to display some of the accessibility features, Can be turned on 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.
Android Secret Code