stopForegroundService method

  1. @override
Future<MapxusMethodResponse> stopForegroundService()
override

Stops the Android foreground service and removes the persistent notification.

Implementation

@override
Future<MapxusMethodResponse> stopForegroundService() async {
  try {
    final result = await _channel.invokeMethod<Map<dynamic, dynamic>>('stopForegroundService');
    return MapxusMethodResponse.fromMap({
      'success': result?['success'] ?? false,
      'message': result?['message'] ?? 'Unknown error',
    });
  } catch (e) {
    return MapxusMethodResponse.fromMap({
      'success': false,
      'message': e.toString(),
    });
  }
}