rekabhq / background_locator

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

FlutterCallbackInformati…formation(callbackHandle) must not be null LocatorService.kt line 81 #103

Open ThiagoCortez81 opened 4 years ago

ThiagoCortez81 commented 4 years ago

Hey guys, how are you doing?

I'm experiencing this issue with background_locator... in LocatorService.kt my dart callback is getting null sometimes, and in another times, it works great... I think when the screen is off, all gets null and in a moment all gets working, and then, wrong again... Have you guys ever experienced this? This is happening with many devices using my app.

My flutter doctor: [✓] Flutter (Channel unknown, v1.17.0, on Linux, locale pt_BR.UTF-8)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3) [✓] Android Studio (version 4.0) [!] VS Code (version 1.46.1) ✗ Flutter extension not installed; install from https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (1 available)

Background_locator version: 1.1.10+1;

Thanks y'all.

allanguintu commented 4 years ago

Fatal Exception: java.lang.RuntimeException Unable to create service rekab.app.background_locator.LocatorService: java.lang.IllegalStateException: FlutterCallbackInformati…formation(callbackHandle) must not be null

This is message has been flooding my crashlytics. Been coming back and forth here to check if someone else has been experiencing this same error. Hope somebody could point us on how to fix/get some workaround this error.

elouiestudent commented 4 years ago

I got that error when I tried to start the background location update before initializing it. Not sure whether this is the cause of your errors, but you can check for this case anyway.

ThiagoCortez81 commented 4 years ago

@elouiestudent I will try to review my code and find if this occurs. I noticed this issue only when the app is in background by a long time, not in initialization.

Thanks!

mehdok commented 4 years ago

@ThiagoCortez81 Did you find any solution?

ThiagoCortez81 commented 4 years ago

@mehdok , unfortunately no! :( I'm still with experiencing this issue...

hasitha3rd commented 3 years ago

I also got the same issue. somehow the issue was with not initializing backgroundlocator before calling BackgroundLocator.registerLocationUpdate(...)

So I make sure IsolateNameServer is registered and the BackgroundLocator service is initialized. await BackgroundLocator.initialize();

then the issue was fixed for me...

ghost commented 3 years ago

I also got the same issue. somehow the issue was with not initializing backgroundlocator before calling BackgroundLocator.registerLocationUpdate(...)

So I make sure IsolateNameServer is registered and the BackgroundLocator service is initialized. await BackgroundLocator.initialize();

then the issue was fixed for me...

@hasitha3rd solution works for me. Thank you!