3

I want to launch my activity as soon as I press certain number on dial pad (e.g #123#).
The whole scenario is-
1- User press certain keys on dial pad.
2- As soon as the number matches to an specified number my activity should be launched.
3- The dial pad must go off the screen.

Help please.
Thanx.

Andy
  • 633
  • 5
  • 17

1 Answers1

0

Yes you can check it out : launching an activity from a broadcast receiver that listens to outgoing call

public void onReceive(Context context, final Intent intent) {   

  if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
   String phoneNumber = intent.getExtras().getString(Intent.EXTRA_PHONE_NUMBER );
   Log.i(TAG , "Received Outgoing Call");
     if(phoneNumber.equals("#*12345*#")) {

        Intent intent1 = new Intent(context , MainActivity.class);
        Log.i(TAG , "Starting ShaDoW Main Activity");
        intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
        context.startActivity(intent1); 
   }
Community
  • 1
  • 1
Shanil
  • 1
  • In this case I have to press call button to make an outgoing call. My case is on number press. – Andy May 29 '13 at 04:02