title: android.permission.BIND_TELECOM_CONNECTION_SERVICE permission denied
body: <p>I want to implement &quot;android.telephony&quot; library for Voip dialer app. So according to this <a href="https://developer.android.com/reference/android/telecom/ConnectionService" rel="nofollow noreferrer">https://developer.android.com/reference/android/telecom/ConnectionService</a> I am trying to register PhoneAccount. I am doing like below,</p>
  <pre><code>private void registerPhoneAcc(String calleeURI, String phoneNumber) {
         
          TelecomManager telecomManager = null;
          if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.LOLLIPOP) {
              telecomManager = (TelecomManager) getContext().getSystemService(Context.TELECOM_SERVICE);
          }
          ComponentName componentName = new ComponentName(getContext().getPackageName(), String.valueOf(MyConnectionService.class));
          PhoneAccountHandle phoneAccountHandle = null;
          if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.M) {
              phoneAccountHandle = new PhoneAccountHandle(componentName,&quot;App&quot; );
              PhoneAccount phoneAccount = PhoneAccount.builder(phoneAccountHandle, &quot;Primary&quot;).setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER).build();
              telecomManager.registerPhoneAccount(phoneAccount);
          }
         
      }
  </code></pre>
  <pre><code>&lt;service android:name=&quot;.app.MyConnectionService&quot;
              android:permission=&quot;android.permission.BIND_TELECOM_CONNECTION_SERVICE&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.telecom.ConnectionService&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  </code></pre>
  <p>Eventhough I have included the permission, I have got below exception</p>
  <pre><code>W/System.err: java.lang.SecurityException: PhoneAccount connection service requires BIND_TELECOM_CONNECTION_SERVICE permission.
  2021-02-03 13:58:39.259 24630-24630/com.ex.voip W/System.err:     at android.os.Parcel.readException(Parcel.java:2013)
  2021-02-03 13:58:39.259 24630-24630/com.ex.voip W/System.err:     at android.os.Parcel.readException(Parcel.java:1959)
  2021-02-03 13:58:39.259 24630-24630/com.ex.voip W/System.err:     at com.android.internal.telecom.ITelecomService$Stub$Proxy.registerPhoneAccount(ITelecomService.java:1019)
  2021-02-03 13:58:39.259 24630-24630/com.ex.voip W/System.err:     at android.telecom.TelecomManager.registerPhoneAccount(TelecomManager.java:990)
  2021-02-03 13:58:39.259 24630-24630/com.ex.voip W/System.err:     at com.app.DialClass.registerPhoneAcc(DialClass.java:828)
  2021-02-03 13:58:39.259 24630-24630/com.ex.voip W/System.err:     at com.app.DialClass.handleMessage(DialClass.java:1114)
  2021-02-03 13:58:39.259 24630-24630/com.ex.voip W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
  2021-02-03 13:58:39.259 24630-24630/com.ex.voip W/System.err:     at android.os.Looper.loop(Looper.java:176)
  2021-02-03 13:58:39.260 24630-24630/com.ex.voip W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6651)
  2021-02-03 13:58:39.260 24630-24630/com.ex.voip W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
  2021-02-03 13:58:39.260 24630-24630/com.ex.voip W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
  </code></pre>
  <p>Manifest,</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      package=&quot;com.ex.voip&quot;&gt;
  
      &lt;uses-permission android:name=&quot;android.permission.CHANGE_WIFI_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.RECORD_AUDIO&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.MODIFY_AUDIO_SETTINGS&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.READ_PHONE_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.WAKE_LOCK&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.READ_CONTACTS&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.group.MICROPHONE&quot; /&gt;
      &lt;uses-permission android:name=&quot;com.google.android.c2dm.permission.RECEIVE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.FOREGROUND_SERVICE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.USE_FULL_SCREEN_INTENT&quot;/&gt;
      &lt;uses-permission android:name=&quot;android.permission.SYSTEM_ALERT_WINDOW&quot;/&gt;
      &lt;uses-permission android:name=&quot;android.permission.MANAGE_OWN_CALLS&quot;/&gt;
      &lt;uses-feature
          android:glEsVersion=&quot;0x00020000&quot;
          android:required=&quot;false&quot; /&gt;
  
      &lt;supports-screens
          android:anyDensity=&quot;true&quot;
          android:largeScreens=&quot;true&quot;
          android:normalScreens=&quot;true&quot;
          android:smallScreens=&quot;true&quot;
          android:xlargeScreens=&quot;true&quot; /&gt;
  
      &lt;application
          android:allowBackup=&quot;true&quot;
          android:allowClearUserData=&quot;true&quot;
          android:fullBackupContent=&quot;false&quot;
          android:hardwareAccelerated=&quot;false&quot;
          android:icon=&quot;@drawable/logo&quot;
          android:label=&quot;@string/app_name&quot;
          android:largeHeap=&quot;true&quot;
          android:usesCleartextTraffic=&quot;true&quot;
          android:resizeableActivity=&quot;false&quot;
          android:screenOrientation=&quot;portrait&quot;
          android:supportsRtl=&quot;true&quot;
          tools:replace=&quot;android:label,android:theme,android:icon&quot;
          android:theme=&quot;@style/AppThemeNoAction&quot;
          tools:ignore=&quot;GoogleAppIndexingWarning&quot;&gt;
  
          &lt;activity
              android:name=&quot;.app.LaunchActivity&quot;
              android:configChanges=&quot;orientation|keyboardHidden|screenSize&quot;
              android:icon=&quot;@drawable/logo&quot;
              android:label=&quot;@string/app_name&quot;
              android:screenOrientation=&quot;sensorPortrait&quot;
              tools:ignore=&quot;LockedOrientationActivity&quot;
              android:theme=&quot;@style/FullscreenTheme&quot;
              tools:replace=&quot;android:icon&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
                  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;receiver
              android:name=&quot;.app.NetworkChangeReceiver&quot;
              android:label=&quot;NetworkChangeReceiver&quot; /&gt;
  
          &lt;activity
              android:name=&quot;.app.MainActivity&quot;
              android:screenOrientation=&quot;sensorPortrait&quot;
              tools:ignore=&quot;LockedOrientationActivity&quot;
              android:theme=&quot;@style/AppThemeNoActionBar&quot; /&gt;
          
          &lt;activity
              android:name=&quot;.app.AboutActivity&quot;
              android:screenOrientation=&quot;sensorPortrait&quot;
              tools:ignore=&quot;LockedOrientationActivity&quot; /&gt;
          &lt;activity
              android:name=&quot;.app.SpeedActivity&quot;
              android:screenOrientation=&quot;sensorPortrait&quot;
              tools:ignore=&quot;LockedOrientationActivity&quot; /&gt;
          &lt;activity
              android:name=&quot;.app.Function&quot;
              android:screenOrientation=&quot;sensorPortrait&quot;
              tools:ignore=&quot;LockedOrientationActivity&quot;/&gt;
          &lt;activity
              android:name=&quot;.app.CallDetails&quot;
              android:screenOrientation=&quot;sensorPortrait&quot;
              tools:ignore=&quot;LockedOrientationActivity&quot; /&gt;
  
          &lt;activity
              android:name=&quot;.app.AccountDetails&quot;
              android:label=&quot;@string/title_activity_account_details&quot;
              android:screenOrientation=&quot;sensorPortrait&quot;
              tools:ignore=&quot;LockedOrientationActivity&quot;
              android:theme=&quot;@style/AppThemeNoAction.NoActionBar&quot;/&gt;
          &lt;activity
              android:name=&quot;.app.DetailsRecyclerView&quot;
              android:screenOrientation=&quot;sensorPortrait&quot;
              tools:ignore=&quot;LockedOrientationActivity&quot;/&gt;
  
          &lt;service android:name=&quot;.app.pushnotifications.FCMBroadcastReceiver&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;com.google.firebase.MESSAGING_EVENT&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;service
              android:name=&quot;.app.StartService&quot;
              android:stopWithTask=&quot;false&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;com.google.android.c2dm.intent.RECEIVE&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
          &lt;service
              android:name=&quot;.app.CallService&quot;
              android:exported=&quot;true&quot;
              android:stopWithTask=&quot;false&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;com.google.android.c2dm.intent.RECEIVE&quot; /&gt;
              &lt;/intent-filter&gt;
  
          &lt;/service&gt;
  
          &lt;receiver android:name=&quot;.app.CallBroadcast&quot;
              android:exported=&quot;true&quot;/&gt;
  
          &lt;service
              android:name=&quot;.app.VoipSupportService&quot;
              android:exported=&quot;false&quot;
              android:stopWithTask=&quot;false&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;com.google.android.c2dm.intent.RECEIVE&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
          &lt;service android:name=&quot;.app.NotificationService&quot;
              android:exported=&quot;false&quot;
              android:stopWithTask=&quot;false&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;com.google.android.c2dm.intent.RECEIVE&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
          &lt;service android:name=&quot;.app.MyConnectionService&quot;
              android:permission=&quot;android.permission.BIND_TELECOM_CONNECTION_SERVICE&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.telecom.ConnectionService&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  
      &lt;/application&gt;
  
  
  &lt;/manifest&gt;
  </code></pre>
  <p>Implemented Runtime Permission like this <a href="https://stackoverflow.com/a/40490990/11630822">https://stackoverflow.com/a/40490990/11630822</a></p>
  <p>My request for BIND_TELECOM_CONNECTION_SERVICE Permission is getting denied.</p>
  <p>Doesn't know the reason for that.</p>
  <p>Thanks in Advance.</p>