rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
288 stars 329 forks source link

FATAL EXCEPTION: main ,android.location.LocationListener.onStatusChanged #199

Closed tranice closed 3 years ago

tranice commented 3 years ago

I ran test app in HUAWEI P10 (VTR-AL00), when start location and received data, app crashed immediately

code:

BackgroundLocator.registerLocationUpdate(LocationCallbackHandler.callback, //initCallback: LocationCallbackHandler.initCallback, //initDataCallback: data, / Comment initDataCallback, so service not set init variable, variable stay with value of last run after unRegisterLocationUpdate / disposeCallback: LocationCallbackHandler.disposeCallback, iosSettings: IOSSettings(accuracy: LocationAccuracy.NAVIGATION, distanceFilter: 0), autoStop: false, androidSettings: AndroidSettings( accuracy: LocationAccuracy.NAVIGATION, //interval: option.interval, //distanceFilter: option.distanceFilter, client: option.locationType =LocationClient.android, androidNotificationSettings: AndroidNotificationSettings( notificationChannelName: 'Location tracking', notificationTitle: 'Recording...', notificationMsg: '', notificationBigMsg: '', notificationIcon: '', notificationIconColor: Colors.grey, notificationTapCallback: LocationCallbackHandler.notificationCallback))) .catchError((error) { log(error.toString()); });

output:

Launching lib\main.dart on VTR AL00 in debug mode... package:background_locator_example/main.dart √ Built build\app\outputs\flutter-apk\app-debug.apk. Connecting to VM Service at ws://127.0.0.1:14661/lWitdJNwiEA=/ws I/flutter (19481): Initializing... I/flutter (19481): Initialization done I/flutter (19481): Running false I/hwaps (19481): JNI_OnLoad I/flutter (19481): *****Init callback handler I/flutter (19481): 1 I/flutter (19481): *notificationCallback E/AndroidRuntime(19481): FATAL EXCEPTION: main E/AndroidRuntime(19481): Process: rekab.app.background_locator_example, PID: 19481 E/AndroidRuntime(19481): java.lang.AbstractMethodError: abstract method "void android.location.LocationListener.onStatusChanged(java.lang.String, int, android.os.Bundle)" E/AndroidRuntime(19481): at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:324) E/AndroidRuntime(19481): at android.location.LocationManager$ListenerTransport.-wrap0(LocationManager.java) E/AndroidRuntime(19481): at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:242) E/AndroidRuntime(19481): at android.os.Handler.dispatchMessage(Handler.java:105) E/AndroidRuntime(19481): at android.os.Looper.loop(Looper.java:156) E/AndroidRuntime(19481): at android.app.ActivityThread.main(ActivityThread.java:6577) E/AndroidRuntime(19481): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(19481): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:942) E/AndroidRuntime(19481): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:832) I/Process (19481): Sending signal. PID: 19481 SIG: 9 Lost connection to device. Exited (sigterm)

PaulBout1 commented 3 years ago

everyone is getting that issue. Please take a look at https://github.com/rekab-app/background_locator/issues/188#issuecomment-769092890 and https://github.com/rekab-app/background_locator/issues/190#issuecomment-768926570

michaelchiew08 commented 3 years ago

advised to change

LocationClient.android > LocationClient.google instead... it should solve your problem

amir067 commented 3 years ago

overide function OnProviderCHanged() will solve this issue i tried it works.

mehdok commented 3 years ago

This problem is fixed in #241 ; Please use the latest version;