Programmatically enter secret code like *#*#4636#*#* on Android

前端 未结 5 1033
南方客
南方客 2020-11-27 15:37

On many Android devices you can get into a secret settings menu from Phone app by typing in

*#*#4636#*#*

http://technology-headlines.com/2010/09/17/4636-and

5条回答
  •  感动是毒
    2020-11-27 16:16

    Secret codes exist and work independent of the dialer application. The dialer application just provides a handy interface for these codes. It recognizes the special string and then calls a special intent to invoke the action. You shouldn't use the dialer to call these dialogs. Instead you can call the secret codes directly yourself like the dialer does internally:

    Invoking built in secret codes:

    What the dialer really does when you enter the code is extracting the number between *#*# and #*#* and then broadcasting the following intent:

    sendBroadcast(new Intent("android.provider.Telephony.SECRET_CODE", Uri.parse("android_secret_code://4636")));
    

    Register your own secret codes (if you like):

    You can even register your own secret code actions using:

     
     
    

    Source: http://android.amberfog.com/?p=422

    Edit: Fixed a bug in the original code (see comment)

提交回复
热议问题