flutter_background_service icon indicating copy to clipboard operation
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)

Open SaikiranReddy412 opened this issue 2 years ago • 5 comments

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)

SaikiranReddy412 avatar Apr 27 '22 10:04 SaikiranReddy412

I am having this same issue. Even I am not be able to get this method Geolocator.registerWith();

jayghetia avatar May 03 '22 03:05 jayghetia

Did anyone got solution for this issue

Shrulabh avatar May 05 '22 10:05 Shrulabh

@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

ekasetiawans avatar May 05 '22 11:05 ekasetiawans

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();
}

}

SaikiranReddy412 avatar May 05 '22 12:05 SaikiranReddy412

@Saikiran24 Does it work in IOS ?

lel101 avatar May 10 '22 02:05 lel101