title: How to stop native phone call activity from displaying?
body: <h1>Background</h1>
  
  <p>Our team is developing an app that needs to be able to make calls from a personalized list of contacts. The app also should be able to handle the call from within it's activity, and not the native one.</p>
  
  <p>Using the ITelephony interface it is already capable of turning speaker and mute on/off, also ending the call. The problem is that the call() method from ITelephony (the one that makes calls) requires a permission that is protected, only system level apps can access it.</p>
  
  <p>At this moment we are using a workaround, we make the call using Intent.ACTION_CALL, and once the call is stared we place our calling activity on top of the native using a broadcast receiver that listens to NEW_OUTGOING_CALL. It works, but when we make the call the native activity pops on the screen and only then our activity is started, which looks awful.</p>
  
  <p>Receiver:</p>
  
  <pre><code>public class OutgoingCallReceiver extends BroadcastReceiver {
  private static final String TAG = OutgoingCallReceiver.class.getSimpleName();
  
  @Override
  public void onReceive(Context context, Intent intent) {
      Log.i(TAG, "OutgoingCallReceiver CHAMADO");
      //abortBroadcast();
  
      Intent i = new Intent();
      i.setClass(context, CallingViewImpl.class);
      i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  
      //waiting 1 second so the native activity won't pop up on top of our activity
      try {
          Thread.sleep(1000);
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
      context.startActivity(i);
  }
  }
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/aKP8j.gif" rel="nofollow">Here's a gif showing the flow, don't mind the alert error, it is because I was using a phone with no sim card.</a></p>
  
  <h1>Question</h1>
  
  <p>Is there anyway to prevent the native activity from appearing without stopping the call? Or is there another solution to this problem?</p>