Closed efstathiosntonas closed 1 year ago
same
after switching to locationProvider: "playServices"
I ~do not get timeouts anymore~ get fewer timeouts on Samsung S22 Android 13 but on a Xiami Note 8 Android 11 it throws this and insta crashes:
FATAL EXCEPTION: main
Process: com.hiki, PID: 16713
java.lang.NullPointerException: Listener must not be null
at com.google.android.gms.common.internal.Preconditions.checkNotNull(com.google.android.gms:play-services-basement@@18.1.0:2)
at com.google.android.gms.common.api.internal.ListenerHolders.createListenerKey(com.google.android.gms:play-services-base@@18.0.1:1)
at com.google.android.gms.location.FusedLocationProviderClient.removeLocationUpdates(com.google.android.gms:play-services-location@@20.0.0:6)
at com.reactnativecommunity.geolocation.PlayServicesLocationManager$1.onLocationResult(PlayServicesLocationManager.java:74)
at com.google.android.gms.internal.location.zzaw.notifyListener(com.google.android.gms:play-services-location@@20.0.0:2)
at com.google.android.gms.common.api.internal.ListenerHolder.zaa(com.google.android.gms:play-services-base@@18.0.1:2)
at com.google.android.gms.common.api.internal.zacb.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:8057)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
After running the example I was able to get the location only if enableHighAccuracy: false
. The test case High Accuracy
always fails with timeout. On normal example I've added timeout: 120000
but still I get timeout.
Please note:
Hey @efstathiosntonas - thank you for reporting! I'll take look as soon as I will have some time. Meanwhile, if you'd like to attempt fixing this issue, feel free to send a PR.
I've got the exact same issue with Android when enableHighAccuracy : true
as @efstathiosntonas with the same circumstances (testing indoors near the window, no SIM card). Works fine on iOS.
Should be addressed in https://github.com/michalchudziak/react-native-geolocation/pull/230
In the meanwhile, you can get around this by just passing in a sensible timeout
value
Addressed in 3.0.5
I have 3.0.5 and the problem remains
Environment
Platforms
Android
Versions
Description
After upgrading to
3.0.4
I get location timeouts, sometimes it manages to get location some time it does not. Please note that the device (Samsung S22 Android 13) doesn't have a sim card. Downgrading to 3.0.3 it works as a charm even though I had topatch-package
this PR.edit: the granted permissions are approximate, I've opened google maps, gave approximate permissions too and it could find my location.
These are the configs:
App.tsx:
and :
Reproducible Demo