Location watchPositionAsync

Hello, I have a problem with wathPositionAsync. These are my settings:

const LOCATION_SETTINGS = {
  accuracy: Location.Accuracy.Balanced,
  timeInterval: 200,
  distanceInterval: 0,
};

Location.watchPositionAsync(LOCATION_SETTINGS, (location) => callback(location));

I update the state of a component every time the callback function is called, but it seems to be called just every second, doesn’t matter what timeInterval I set. If a put a bigger timeInterval, for example 5000, the same behaviour happens, the callback function is called every second. Am I doing something wrong or that property doesn’t work?

Thanks!

Hey @swampi,

What SDK version are you using? Also, can you create a Snack that is able to reproduce this issue so we can test it on our end?

Cheers,
Adam

I’m using expo 34.0.1 and react native sdk 34.0.0.
I also added a snack: awkward scones - Snack

1 Like

Any updates about this?

@adamjnav On my Galaxy S8 phone running Android 9 I get updates about every 5 seconds (but it varies between about 4.5 and 5.5 seconds)

I’ve combined elements of @swampi’s snack and @charliecruzan’s basic location example in the following snack:

What’s the expected resolution of the timeInterval? Maybe the phone just can’t provide updates faster than a certain number of (milli)seconds?

Some possibly related links:

Using intervals of a few seconds should be reserved for foreground use cases.

Some info on the Fused Location Provider.

From Android dev guide “minTime under 60000ms are not recommended”

With accuracy and displacement set to 0 you will receive locations as fast as the device provides it.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.