Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhoneAccount Connection service requires BIND_TELECOM_CONNECTION_SERVICE permission #757

Closed
1 of 3 tasks
Phillupz opened this issue Jan 21, 2024 · 2 comments
Closed
1 of 3 tasks

Comments

@Phillupz
Copy link

Phillupz commented Jan 21, 2024

Bug report

  • I've checked the example to reproduce the issue.

  • Reproduced on:

  • Android

  • iOS

Description

Calling RNCallKeep.setup causes app to crash with PhoneAccount connection service requires BIND_TELECOM_CONNECTION_SERVICE permission error. This error appears to typically be caused by a misconfiguration. After carefully reviewing the installation steps, reviewing my implementation, and rebuilding and testing the expo development client, I don't believe that's the case here. The logs have been edited to remove potentially sensitive information, for example, com.company.app.

RNCallKeep.setup is being called in a useEffect 2 seconds after the main tab navigator mounts upon initial app launch.

  1. Followed all configuration steps:

// AndroidManifest.xml permissions

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION"/>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  <uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE"/>
  <uses-permission android:name="android.permission.BLUETOOTH"/>
  <uses-permission android:name="android.permission.CALL_PHONE"/>
  <uses-permission android:name="android.permission.CAMERA"/>
  <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
  <uses-permission android:name="android.permission.READ_CALENDAR"/>
  <uses-permission android:name="android.permission.READ_CONTACTS"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
  <uses-permission android:name="android.permission.RECORD_AUDIO"/>
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
  <uses-permission android:name="android.permission.VIBRATE"/>
  <uses-permission android:name="android.permission.WAKE_LOCK"/>
  <uses-permission android:name="android.permission.WRITE_CALENDAR"/>
  <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
  <uses-feature android:name="android.hardware.microphone"/>
  <uses-feature android:name="android.hardware.camera"/>
  <uses-feature android:name="android.hardware.audio.output"/>

// AndroidManifest.xml - within the application tags

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

// app.config.ts android permission config for good measure:

android: {
      googleServicesFile: "./google-services.json",
      package: "com.company.app",
      allowBackup: false,
      versionCode: 21,
      adaptiveIcon: {
        foregroundImage: "./assets/logos/companyAppLogo1000x1000.png"
      },
      permissions: [
        "android.permission.ACCESS_NETWORK_STATE",
        "android.permission.BLUETOOTH",
        "android.permission.CAMERA",
        "android.permission.INTERNET",
        "android.permission.MODIFY_AUDIO_SETTINGS",
        "android.permission.RECORD_AUDIO",
        "android.permission.SYSTEM_ALERT_WINDOW",
        "android.permission.WAKE_LOCK",
        "android.permission.READ_EXTERNAL_STORAGE",
        "android.permission.WRITE_EXTERNAL_STORAGE",
        "android.permission.ACCESS_MEDIA_LOCATION",
        "android.permission.READ_PHONE_STATE",
        "android.permission.CALL_PHONE",
        "android.permission.BIND_TELECOM_CONNECTION_SERVICE",
        "android.permission.FOREGROUND_SERVICE"
      ]
    },

I've also tried updating android/app/src/debug targetApi to 30 along with setting the minSdkVersion in expo build properties to 30.

Here's my options object:

    const CKConfig = {
      ios: {
        appName: 'App Name',
        imageName: 'grayscale-icon',
        supportsVideo: true,
        maximumCallGroups: '1',
        maximumCallsPerCallGroup: '1'
      },
      android: {
        alertTitle: 'Permissions required',
        alertDescription: 'App needs to access your phone accounts',
        cancelButton: 'Cancel',
        okButton: 'Ok',
        additionalPermissions: [],
        imageName: 'grayscale-icon',
        selfManaged: false,
        // Required to get audio in background when using Android 11
        foregroundService: {
          channelId: 'com.company.app',
          channelName: 'Foreground service for my app',
          notificationTitle: 'My app is running on background',
          notificationIcon: 'app-icon',
        }, 
      }

Steps to Reproduce

  1. Follow the example

Versions

- Callkeep: 4.3.12
- React Native: 0.72.6
- Expo: 49.0.9
- Expo Dev Client: 2.4.12
- iOS: N/A
- Android: 12
- Phone model: GN2200

Logs

Stack strace:

PhoneAccount connection service requires BIND_TELECOM_CONNECTION_SERVICE permission.

Remote stack trace:
at
com.android.server.telecom.PhoneAccountRegistrar.registerPhoneAccount(PhoneAccountRegistrar.java:871)
at
com.android.server.telecom.TelecomServicelmpl$1.registerPhoneAccount(TelecomServicelmpl.java:675)
at
com.android.internal.telecom.ITelecomService$Stub.onTransact(ITelecomService.java:1035)
at
com.android.server.telecom.TelecomService.lmpl$1.onTransact(TelecomServicelmpl.java:228)

Logcat:

D [RNCallKeepModule] setup : {"selfManaged":false,"imageName":"grayscale-icon","okButton":"Ok","additionalPermissions":["android.permission.READ_PHONE_STATE","android.permission.CALL_PHONE"],"cancelButton":"Cancel","alertDescription":"App needs to access your phone accounts","foregroundService":{"notificationIcon":"app-icon","notificationTitle":"My app is running on background","channelName":"Foreground service for my app","channelId":"com.company.app"},"alertTitle":"Permissions required"}
D [VoiceConnectionService] setAvailable: false
D [VoiceConnectionService] setInitialized: true
D [RNCallKeepModule] setSettings : {"selfManaged":false,"imageName":"grayscale-icon","okButton":"Ok","additionalPermissions":["android.permission.READ_PHONE_STATE","android.permission.CALL_PHONE"],"cancelButton":"Cancel","alertDescription":"ChatrrApp needs to access your phone accounts","foregroundService":{"notificationIcon":"app-icon","notificationTitle":"My app is running on background","channelName":"Foreground service for my app","channelId":"com.telecain.chatrrapp"},"alertTitle":"Permissions required"}
D [RNCallKeepModule] API Version supports self managed, but it is not enabled in setup
D [RNCallKeepModule] setSettings : {"selfManaged":false,"imageName":"grayscale-icon","okButton":"Ok","additionalPermissions":["android.permission.READ_PHONE_STATE","android.permission.CALL_PHONE"],"cancelButton":"Cancel","alertDescription":"App needs to access your phone accounts","foregroundService":{"notificationIcon":"app-icon","notificationTitle":"My app is running on background","channelName":"Foreground service for my app","channelId":"com.company.app"},"alertTitle":"Permissions required"}
D [RNCallKeepModule] registerPhoneAccount
V unRegisterListener by com.facebook.react.common.ShakeDetector
D onPause()
I [GESTURE HANDLER] Tearing down gesture handler registered for root view com.facebook.react.ReactRootView{a25fabe V.E...... ........ 0,0-1080,2268 #33}
I ✅ ModuleRegistry was destroyed
I ✅ AppContext was destroyed
I ✅ KotlinInteropModuleRegistry was destroyed
D instance-destroyed
D Add to mViews: DecorView@55819ac[DevLauncherErrorActivity],pkg= com.company.app
E destroyRootView called
E destroyRootView called, unmountReactApplication
V setLastReportedMergedConfiguration mZoomDisplayHeight: 2400 getDecorView.89659820
D VRR [FRTC] client handle [bufferId:18446744073709551615 framenumber:0] [ffffffff, ffffffff]
I Skipped: false 2 cost 40.751762 refreshRate 0 processName com.telecain.chatrrapp
E asyncReportFrames skippedFrames= 2 true
D AudioTrackExtImpl init
D set() streamType -1, sampleRate 44100, format 0x1, channelMask 0x3, frameCount 14144, flags #0, notificationFrames 0, sessionId 1873, transferType 3, uid -1, pid -1 cbf 1
D set(): Building AudioTrack with attributes: usage=1 content=0 flags=0xa00 tags=[]
D DEBUG: elapsed 0 / 4
I createTrack_l(146) on outputId(29) : 0xb400007a138cf400, mCblk = 0x7d3a0ad100,  mLatency = 429, mAfLatency = 109, frameCount = 14144, mSampleRate = 44100, mFlags = 0x8, mReqFrameCount = 14144, mNotificationFramesAct = 7072
V checkInListByUid module:audio-choppy-boost uid:10493 cost 154us return (null)
V checkInListByUid start module:change-futex-timeout uid:10493  time 35575895753us
V checkInListByUid end module:change-futex-timeout uid:10493  time 35575895836us
D checkInListByUid module:change-futex-timeout uid:10493 cost 83us return 0
D setVolume left 0.000 right 0.000 , callingPid 8993
E BLASTBufferItemConsumer::onDisconnect()
D bufferpool2 0xb400007720bc9028 : 0(0 size) total buffers - 0(0 size) used buffers - 115/120 (recycle/alloc)
@Phillupz
Copy link
Author

I was able to resolve this issue by using the following config plugin:

config-plugins/react-native-callkeep

@ark-fabtechsol
Copy link

ark-fabtechsol commented Jun 2, 2024

hi, I need some assistance , I gave all the permissions , Basically i was trying to call via my mobile sim cards using the phone's default calling screen, it asks for permissions , takes me to phone accounts were i give permission to my app and then when i make call , it uses mobiles default calling screen to make a call.

issue:
The issue is that the call keeps dialing and does not stop secondly the call does not connects to the other user and his phone doesnt ring.

i have just two functions in my app one to start call other to end. right now i didnt impleented any call reciving functionality but because it is calling via sim so the other user mst recive the call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants