Secret Phone number

Written by Xavier Gouchet - 14 august 2013 - no comments

So maybe you already know that some secret phone numbers are hidden in Android. For instance, if you dial *#*#4636#*#* on your Android phone1, you'll access a secret settings panel.

But did you know that you can add this feature in your own android application ? Basically, you can setup a BroadcastReceiver to listen to a secret number and then launch a hidden Activity. This can be used to unlock some beta features or access developper options on your app. Or just add an easter egg to your phone.

To do that, you simply need to declare your BroadcastReceiver in your manifest, like this :

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

After that, you simply need to handle the corresponding Intent in your BroadcastReceiver :


public class MySecretBroadcastReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		if (intent.getAction().equals("android.provider.Telephony.SECRET_CODE")) {
			// Do something in here
		}
	}

}

Write a comment