How to create an application that can be launched using dialpad


I wanted to know how I can run an Android app with some code from Dialpad. For example, if you ## 3214789650 ## from your galaxy, it launches the angryGps application.
How to implement this?

Thank.

+3
source share
2 answers

try this.use Broadcast Receivers to listen for the outgoing call number:

Manifest.xml

uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>


<receiver android:name=".OutgoingCallReceiver"> 
<intent-filter> 
<action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
</intent-filter> 
</receiver>

OutgoingCallReceiver.java

public class OutgoingCallReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        Bundle bundle = intent.getExtras();
        if (null == bundle)
            return;
        // outgoingNumber=intent.getStringExtra(Intent.ACTION_NEW_OUTGOING_CALL);
        String phoneNubmer = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
       //START APPLICATION HERE
    }
}
+5
source

What you are looking for is part of the contact application, and although it is very likely that the implementation is the same for each manufacturer, I am not sure about that.

handleSecretCode SpecialCharSequenceMgr.

    static boolean handleSecretCode(Context context, String input) {

    // Secret codes are in the form *#*#<code>#*#*

    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); 

, Intents.SECRET_CODE_ACTION uri android_secret_code:// "code" , .

, , , , - * # * # 4636 # * # *.

+1

All Articles