flutter_background_service
flutter_background_service copied to clipboard
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method getCurrentPosition on channel flutter.baseflow.com/geolocator)
For GeoLocator plugin I am registering with this
static void onStart(ServiceInstance _service) async { if (Platform.isAndroid) { Geolocator.registerWith(); } }
but it is not working in service throwing exception below
[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method getCurrentPosition on channel flutter.baseflow.com/geolocator)
I am having this same issue. Even I am not be able to get this method Geolocator.registerWith();
Did anyone got solution for this issue
@Saikiran24 You have to register the platform implementation plugin for Geolocator, here is for android https://github.com/Baseflow/flutter-geolocator/blob/main/geolocator_android/lib/src/geolocator_android.dart
Yes, I got it thank you , have to use like this if anyone facing issues
import this
import 'package:geolocator_android/geolocator_android.dart'; import 'package:geolocator_apple/geolocator_apple.dart';
void onStart(ServiceInstance service) {
if (Platform.isIOS) { FlutterBackgroundServiceIOS.registerWith(); GeolocatorApple.registerWith(); }
if (Platform.isAndroid) {
FlutterBackgroundServiceAndroid.registerWith();
GeolocatorAndroid.registerWith();
}
}
@Saikiran24 Does it work in IOS ?