Skip to content Skip to sidebar Skip to footer

Secret_code Set From Code Android

I know how to work with Secret code from Manifest file, it is working well with this source code:

Solution 1:

Modify Manifest.xml file

<receiverandroid:name="receivers.SecretCodeReceiver"><intent-filter ><actionandroid:name="android.provider.Telephony.SECRET_CODE" /><dataandroid:scheme="android_secret_code" /></intent-filter></receiver>

And modify your Broadcast Receiver class

if(intent.getAction().equals("android.provider.Telephony.SECRET_CODE")) {
        Stringuri= intent.getDataString();
        String[] sep = uri.split("://");
        if (sep[1].equalsIgnoreCase("1234")) {
            IntentlaunchIntent= context.getPackageManager().getLaunchIntentForPackage("com.whatsapp");
            context.startActivity(launchIntent);
        } elseif (sep[1].equalsIgnoreCase("5678")) {
            IntentlaunchIntent= context.getPackageManager().getLaunchIntentForPackage("net.one97.paytm");
            context.startActivity(launchIntent);
        } 
    }

Now dial number from dialer*#*#NUMBER#*#* eg.*#*#1234#*#* for launch whatsapp

Post a Comment for "Secret_code Set From Code Android"