startForegroundService method

  1. @override
Future<bool> startForegroundService({
  1. required String pollingUrl,
  2. int? intervalMinutes,
  3. String? channelId,
})
override

Start a foreground service for continuous notification polling.

This creates a persistent notification and runs a service that is less likely to be killed by the system. Use this for more reliable notification delivery. Returns true if the service was started successfully.

Implementation

@override
Future<bool> startForegroundService({
  required String pollingUrl,
  int? intervalMinutes,
  String? channelId,
}) async {
  final result = await methodChannel
      .invokeMethod<bool>('startForegroundService', {
        'pollingUrl': pollingUrl,
        if (intervalMinutes != null) 'intervalMinutes': intervalMinutes,
        if (channelId != null) 'channelId': channelId,
      });
  return result ?? false;
}