2010年8月6日星期五

Google Android secret_code for launching hidden activity

Dial *#*#<code>#*#* to launch the hidden activities.

For example:
Dial <*#*#4636#*#*> will be received by "TestingSettingsBroadcastReceiver".

--Phone.java------------------------------------------------------------------------------
static boolean handleSecretCode(Context context, String input) {


// Secret codes are in the form *#*##*#*

int len = input.length();

if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) {

Intent intent = new Intent(Intents.SECRET_CODE_ACTION,

Uri.parse("android_secret_code://" + input.substring(4, len - 4)));

context.sendBroadcast(intent);

return true;

}


return false;

}
------------------------------------------------------------------------------

<receiver android:name="TestingSettingsBroadcastReceiver">

<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="4636" />
</intent-filter>
</receiver>
------------------------------------------------------------------------------

<receiver android:name="TestingSettingsBroadcastReceiver">

<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data android:scheme="android_secret_code" android:host="225" />
</intent-filter>
</receiver>




没有评论:

发表评论