A Flutter plugin to easily handle realtime location in iOS and Android. Provides settings for optimizing performance or battery.
MIT License
1.11k
stars
815
forks
source link
Attempt to write to field 'io.flutter.plugin.common.MethodChannel$Result com.lyokone.location.FlutterLocation.getLocationResult' on a null object reference #814
Description
So I'm receiving a push notification that should then trigger the package to get the location. It works when the app is in the foreground but throws
Attempt to write to field 'io.flutter.plugin.common.MethodChannel$Result com.lyokone.location.FlutterLocation.getLocationResult' on a null object reference
when the app is in the background. Note: background mode is enabled.
Expected Behavior
I want the location even when the app is in the background.
Steps To Reproduce
Install Firebase messaging.
Set the app in the background with location service in background mode.
receive the background push notification.
trigger getLocation function
See Attempt to write to field 'io.flutter.plugin.common.MethodChannel$Result com.lyokone.location.FlutterLocation.getLocationResult' on a null object reference
Tested on:
Android, API Level 29, simulator
Other plugins:
firebase_messaging: ^14.2.2
Additional logs
E/MethodChannel#lyokone/location( 6178): Failed to handle method call
E/MethodChannel#lyokone/location( 6178): java.lang.NullPointerException: Attempt to write to field 'io.flutter.plugin.common.MethodChannel$Result com.lyokone.location.FlutterLocation.getLocationResult' on a null object reference
E/MethodChannel#lyokone/location( 6178): at com.lyokone.location.MethodCallHandlerImpl.onGetLocation(MethodCallHandlerImpl.java:117)
E/MethodChannel#lyokone/location( 6178): at com.lyokone.location.MethodCallHandlerImpl.onMethodCall(MethodCallHandlerImpl.java:43)
E/MethodChannel#lyokone/location( 6178): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/MethodChannel#lyokone/location( 6178): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#lyokone/location( 6178): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/MethodChannel#lyokone/location( 6178): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#lyokone/location( 6178): at android.os.Handler.handleCallback(Handler.java:883)
E/MethodChannel#lyokone/location( 6178): at android.os.Handler.dispatchMessage(Handler.java:100)
E/MethodChannel#lyokone/location( 6178): at android.os.Looper.loop(Looper.java:214)
E/MethodChannel#lyokone/location( 6178): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#lyokone/location( 6178): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#lyokone/location( 6178): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#lyokone/location( 6178): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Description So I'm receiving a push notification that should then trigger the package to get the location. It works when the app is in the foreground but throws
when the app is in the background. Note: background mode is enabled.
Expected Behavior I want the location even when the app is in the background.
Steps To Reproduce
Tested on:
Other plugins:
firebase_messaging: ^14.2.2
Additional logs