Make my application launch when entering the secret code?

How can I launch an application when a secret code, for example *#*#12345#*#*, is entered into a number?

I could not find a solution in Android docs.

+5
source share
3 answers

Here is how I did it:

I changed the main action to not have any intent filters:

<activity
            android:name=".ParentTrap"
            android:label="@string/title_activity_parent_trap"
            android:theme="@android:style/Theme.Holo" >
        </activity>

Then I made a broadcast receiver with an intent filter action: android.provider.Telephony.SECRET_CODE

Then I added data to it. All of this is below:

<receiver android:name=".ParentTrap$Launch" >
            <intent-filter>
                <action android:name="android.provider.Telephony.SECRET_CODE" />

                <data
                    android:host="(secret code)"
                    android:scheme="android_secret_code" />
            </intent-filter>
        </receiver>

After the class was completed (I made the Launch class in my main class, extending the BroadCast Receiver), and then in the onReceive class launched the intention to start this activity.

Then typing *#*#(secret code)#*#*in the dialer, it will launch the application.

+9
source
+6

, , . Intent.ACTION_CALL . , , specyfic . , ( , ):

<action name=".YourAction">
    <intent-filter . . . >
        <action android:name="android.intent.action.CALL" />
        <!-- data is crutial here, you have to figuire it out exacly yourself -->
        <data android:scheme="tel" android:path="yourSpecyficSecretCode" />
    </intent-filter>
</action>

. LogCat, , , .

0

All Articles