cancel
Showing results for 
Search instead for 
Did you mean: 

requestLocationUpdates & getCurrentLocation failing on first attempt

kkredpill.2025
Honored Guest

Hello,

I'm developing an electron application that we have bridged to meta os using android capacitor, and using a a custom capacitor plugin to access the android api directly to get a user's location.  

I am encountering a problem requesting the location when first launching the application after a fresh boot of a quest 3 headset that has already granted location permissions, calling requestLocationUpdates never returns a value to the locationListener.  Oddly enough, if the user takes the headset off, waits a moment for the screen to go black, and put it back on then miraculously it starts working again.

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0,0, locationListener)


In the same scenario above, but calling getCurrentLocation, after 10 - 15 seconds the accept call back gets a location value of null.  After which point on the second call to the api, we get a valid location.

locationManager.getCurrentLocation(LocationManager.NETWORK_PROVIDER, cancellationSignal, executor, new Consumer<Location>() {


The api are being accessed in accordance with the documentation found here:
https://developers.meta.com/horizon/documentation/native/android/move-location 

Both options don't provide our users with a good experience.  Please help me figure out what is going on so we can reliably get the users location the first time and within a reasonable time frame.

0 REPLIES 0