startBackgroundService method

  1. @override
Future<bool> startBackgroundService({
  1. required NotificationPayload payload,
  2. required ServiceType type,
  3. AndroidCallServiceKind kind = AndroidCallServiceKind.call,
})
override

Starts the foreground service of type for the call in payload.

For ServiceType.call, kind picks which Android service hosts the call, and so which foreground service types it requests.

Implementation

@override
Future<bool> startBackgroundService({
  required NotificationPayload payload,
  required ServiceType type,
  AndroidCallServiceKind kind = AndroidCallServiceKind.call,
}) async {
  if (await isBackgroundServiceRunning(type, callCid: payload.callCid) ==
      false) {
    return await methodChannel.invokeMethod(
      'startBackgroundService',
      {
        ...payload.toJson(),
        'type': type.name,
        'serviceKind': kind.name,
      },
    );
  }
  return false;
}