flutter-webrtc / callkeep

iOS CallKit and Android ConnectionService for Flutter
MIT License
133 stars 147 forks source link

what permissions do i need to get setup() working? #100

Closed cdg720 closed 3 years ago

cdg720 commented 3 years ago

Hi,

I think I don't have all the necessary permissions and await callKeep.setup(null, callSetup); throws an error:

I/flutter (29112): FlutterFire Messaging: An error occurred in your background messaging handler:
I/flutter (29112): PlatformException(E_ACTIVITY_DOES_NOT_EXIST, Activity doesn't exist, null, null)

Full code:

Future<void> firebaseMessagingBackgroundHandler(RemoteMessage message) async {
  await Firebase.initializeApp();

  final callKeep = FlutterCallkeep();
  final callSetup = <String, dynamic>{
    'ios': {
      'appName': 'CallKeepDemo',
    },
    'android': {
      'alertTitle': 'Permissions required',
      'alertDescription':
      'This application needs to access your phone accounts',
      'cancelButton': 'Cancel',
      'okButton': 'ok',
      // Required to get audio in background when using Android 11
      'additionalPermissions': <String>[],
      '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',
      },
    },
  };
  await callKeep.setup(null, callSetup);
}

And in my AndroidManifest.xml, I have the following:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

<!-- Permissions options for the `contacts` group -->
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />

<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" />

What permissions am I missing (https://github.com/flutter-webrtc/callkeep/issues/90)? Or is another issue is causing my problem?

Thanks, DK

cdg720 commented 3 years ago

now it works but i am not sure what i have changed...