title: Android: How to make a default dialer app?
body: <p>Today I got a rejection from Google for my app <a href="https://play.google.com/store/apps/details?id=com.gazman.beep" rel="noreferrer">Facetocall</a></p>
  
  <blockquote>
    <ul>
    <li><p>Your app does not appear to prompt the user to be a default handler prior to requesting related permissions as required by the policy.
    Please make necessary changes in order to comply with policy
    requirements and resubmit your app through a Declaration Form.</p></li>
    <li><p>Default handler capability was listed on your declaration form, but your app has no default handler capability.</p></li>
    </ul>
  </blockquote>
  
  <p>My goal is to make a default dialer app.</p>
  
  <p>Here is my Manifest</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      package="com.gazman.beep"
      android:installLocation="preferExternal"&gt;
  
      &lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt;
      &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
      &lt;uses-permission android:name="android.permission.READ_CALL_LOG" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_CALL_LOG" /&gt;
      &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt;
      ... and other permissions
  
      &lt;application
          android:name=".application.BeepApp"
          android:allowBackup="false"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          tools:ignore="GoogleAppIndexingWarning"&gt;
  
          &lt;activity
              android:name=".system_intents.IntentsActivity"
              android:launchMode="singleTask"
              android:noHistory="true"
              android:theme="@style/Theme.Transparent"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.DIAL" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.DIAL" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
                  &lt;data android:scheme="tel" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;activity
              android:name=".call.CallActivity"
              android:launchMode="singleTop"
              android:screenOrientation="portrait"
              android:showForAllUsers="true" /&gt;
  
          &lt;service
              android:name="com.gazman.beep.call.MyInCallService"
              android:permission="android.permission.BIND_INCALL_SERVICE"&gt;
              &lt;meta-data
                  android:name="android.telecom.IN_CALL_SERVICE_UI"
                  android:value="true" /&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.telecom.InCallService" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          ... And other declarations
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>And here is what I do when my app launches:</p>
  
  <pre><code>private void checkDefaultHandler() {
      if (isAlreadyDefaultDialer()) {
          return;
      }
      Intent intent = new Intent(TelecomManager.ACTION_CHANGE_DEFAULT_DIALER);
      intent.putExtra(TelecomManager.EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME, getPackageName());
      if (intent.resolveActivity(getPackageManager()) != null) {
          startActivityForResult(intent, REQUEST_CODE_SET_DEFAULT_DIALER);
      }
      else{
          throw new RuntimeException("Default phone functionality not found");
      }
  }
  
  private boolean isAlreadyDefaultDialer() {
      TelecomManager telecomManager = (TelecomManager) getSystemService(TELECOM_SERVICE);
      return getPackageName().equals(telecomManager.getDefaultDialerPackage());
  }
  </code></pre>
  
  <p>What am I missing here?</p>
  
  <p>I tried submitting the form again and this time I add a <a href="https://www.youtube.com/watch?v=V5ydUm9KdtI" rel="noreferrer">video</a> that shows my app on an emulator(I see the same behavior on all the real devices too) here is the reply that I got back:</p>
  
  <blockquote>
    <ul>
    <li>Your app does not appear to prompt the user to be a default handler prior to requesting related permissions as required by the policy.
    Please make necessary changes in order to comply with policy
    requirements and resubmit your app through a Declaration Form.</li>
    </ul>
  </blockquote>