Description
I'm trying to call Location().getLocation() from a service created by flutter_background_service plugin, since I want to get location even when app is terminated, and location plugin doesn't seem to support it
Expected behavior
Somehow get location from background?
Steps To Reproduce
create a service
call Location().getLocation() inside the service
Tested on:
Android, API Level 31, real device
iOS, Version XX [e.g. 15], simulator or real device
Other plugins:
flutter_background_service
Additional logs
E/flutter (17736): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Attempt to write to field 'io.flutter.plugin.common.MethodChannel$Result com.lyokone.location.FlutterLocation.getLocationResult' on a null object reference in method 'void com.lyokone.location.MethodCallHandlerImpl.onGetLocation(io.flutter.plugin.common.MethodChannel$Result)', null, java.lang.NullPointerException: Attempt to write to field 'io.flutter.plugin.common.MethodChannel$Result com.lyokone.location.FlutterLocation.getLocationResult' on a null object reference in method 'void com.lyokone.location.MethodCallHandlerImpl.onGetLocation(io.flutter.plugin.common.MethodChannel$Result)'
E/flutter (17736): at com.lyokone.location.MethodCallHandlerImpl.onGetLocation(MethodCallHandlerImpl.java:117)
E/flutter (17736): at com.lyokone.location.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:43)
E/flutter (17736): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (17736): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter (17736): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
E/flutter (17736): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/flutter (17736): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (17736): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (17736): at android.os.Looper.loopOnce(Looper.java:233)
E/flutter (17736): at android.os.Looper.loop(Looper.java:334)
E/flutter (17736): at android.app.ActivityThread.main(ActivityThread.java:8278)
E/flutter (17736): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (17736): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
E/flutter (17736): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1065)
E/flutter (17736): )
Description I'm trying to call Location().getLocation() from a service created by flutter_background_service plugin, since I want to get location even when app is terminated, and location plugin doesn't seem to support it
Expected behavior Somehow get location from background?
Steps To Reproduce create a service call Location().getLocation() inside the service
Tested on:
Other plugins:
flutter_background_service
Additional logs