title: Launch application using dial pad in android
body: <p>I want to launch my application through dial pad.I am using the following code. For dial pad to launch application (in Broadcast receiver)</p>
  
  <pre><code>public class HiddenReceiver extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context context, Intent intent) {
  try{
  
                 // Toast.makeText(context,"Number Dialed",1).show();
  
                  Intent serviceIntent = new Intent(context,MainActivity.class);
                      serviceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                      context.startActivity(serviceIntent);
  
  
  
                  }
                  catch(Exception e)
                  {
                      Log.d(TAG, ""+e.getMessage());
                  }
  </code></pre>
  
  <p>While pressing key through dial pad I want to launch my main activity in which I used the following</p>
  
  <pre><code>public class MainActivity extends Activity
  {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_hidden_receiver); 
  
           //Intent call here
          Intent intent=getIntent();
          String message = intent.getStringExtra(MainActivity.TELEPHONY_SERVICE);
           //text here
  </code></pre>
  
  <p>But when I press my code its dialed number disappear but neither dialer pad disappear nor MainActivity launches.
  how can this issues be resolved?Help me out.....
  Thanks.</p>