title: Making your Android app selectable to handle making a call
body: <p>I've had got allot of help from stackoverflow with programming problems over the years just off google. I have finally run into an issue that i cant solve despite exhaustive searching and looking at different resources on the net. So i am finally making my first post here..</p>
  
  <p>Here's my issue</p>
  
  <p>I'm writing an android dialer app that behaves like a phone app. I need it so that when the user goes to make a call by tapping a contacts phone number, the operating system asks the user if they want to use my app or the default android phone app to carry out the call.</p>
  
  <p>There is a couple of approaches to this i have found that work to different degrees.</p>
  
  <p>Putting this into the manifest along with requesting relevant permissions.</p>
  
  <p><code>&lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.CALL_PRIVILEGED" /&gt;
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
          &lt;data android:scheme="tel" /&gt;
  &lt;/intent-filter&gt;</code> </p>
  
  <p>This worked but not well enough as it failed to work on api 19 or higher. At the time of writing we are upto api 23 (marshmallow). Also using CALL_PRIVILEGED is not recommended.</p>
  
  <p>The second way is using a NEW_OUTGOING_CALL intent receiver, which involves creating a class that extents off BroadcastReceiver, to listen for when the phone attempts to start a call.</p>
  
  <pre><code> &lt;receiver android:name=".OutgoingCallReceiver"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.NEW_OUTGOING_CALL" /&gt;
          &lt;category android:name="android.intent.category.DEFAULT" /&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  </code></pre>
  
  <p><a href="http://android-developers.blogspot.com.au/2013/05/handling-phone-call-requests-right-way.html" rel="nofollow">tutorial here</a></p>
  
  <p>This way worked but to well in the sense that it doesn't even ask the user what app they want to call using and goes straight to my app. Even testing on the latest marshmallow with the right permissions it happily let me take over the phone and effectively force the user to use my app for making calls!</p>
  
  <p>Can anyone help or have run into this issue before?</p>