flutter-webrtc/callkeep

getPhoneAccount.isEnabled() always returns as false

danj565 opened this issue · 1 comments

Great library. thank you! For some reason I cannot get the callback methods to fire. The following line is always returning false regardless of my permissions / setup and I believe that is my problem.

telecomManager.getPhoneAccount(handle).isEnabled()

Here are my permissions:

    <uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

And I also added the following to application:

<service android:name="io.wazo.callkeep.VoiceConnectionService"
          android:label="Wazo"
          android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
          android:foregroundServiceType="camera|microphone"
        >
          <intent-filter>
              <action android:name="android.telecom.ConnectionService" />
          </intent-filter>
        </service>

Maybe because user hasn't added your app to calling account.
if (!_callKeepInited) { _callKeep.setup( null, <String, dynamic>{ 'ios': { 'appName': 'CallKeepDemo', }, 'android': { 'alertTitle': 'Permissions required', 'alertDescription': 'This application needs to access your phone accounts', 'cancelButton': 'Cancel', 'okButton': 'ok', 'foregroundService': { 'channelId': 'com.company.my', 'channelName': 'Foreground service for my app', 'notificationTitle': 'My app is running on background', 'notificationIcon': 'Path to the resource icon of the notification', }, }, }, backgroundMode: true); _callKeepInited = true; }

Use this to fire up the permission so that user can add your app to calling account