Hi, I’m using Location.getCurrentPositionAsync
but it seems to take several seconds on Android whereas it’s fine on iOS. Is there anything I can do about it?
try {
const location = await Location.getCurrentPositionAsync({
timeout: 1000, // 1 second
// I've tried all the different accuracies it doesn't seem to make much difference
accuracy: Location.Accuracy.Balanced
});
return { lat: location.coords.latitude, lng: location.coords.longitude };
} catch (err) {
console.log(`Unable to get location ${err.message}`);
return { lat: 0, lng: 0};
}
I’ve put in the timeout because otherwise it makes the app seem really slow when you press on a button and nothing happens for several seconds. In fact now I cache the location for 5 minutes so I can return it if the real thing times out, but it’s not ideal
Thanks!