在android的手机里,进入拨号程序,输入*#*#4636#*#* 可以看到一个测试应用。
查看Phone的源代码,有一个函数专门处理*#*# 开头,#*#*结尾的拨号字符串。
SpecialCharSequenceMgr.java
/**
* Handles secret codes to launch arbitrary activities in the form of *#*#<code>#*#*.
* If a secret code is encountered an Intent is started with the android_secret_code://<code>
* URI.
*
* @param context the context to use
* @param input the text to check for a secret code in
* @return true if a secret code was encountered
*/
static private boolean handleSecretCode(Context context, String input) {
// Secret codes are in the form *#*#<code>#*#*

本文介绍了Android中处理秘密代码的方式,通过*#*#<code>#*#*启动活动,当输入特定字符串时,系统会发送Intent使用android_secret_code://<code> URI。示例代码展示了如何检测和处理秘密代码,并列出了一些系统内置的秘密代码,如4636、225等。开发者可以模仿示例在AndroidManifest.xml中添加过滤器来支持自定义的秘密代码。
最低0.47元/天 解锁文章
237

被折叠的 条评论
为什么被折叠?



