isForegroundService method
returns true when the current Service instance is in foreground mode.
Implementation
Future<bool> isForegroundService() async {
final result = await _channel.invokeMethod<bool>('isForegroundMode');
return result ?? false;
}