When I apply the code below, watchPositionAsync works only once on both the real device and the emulator (ios simulator runs according to timeInterval, but real ios device runs it once.). How can I make the timeInterval obey and run every 1000ms? Thanks in advance.
let location = null
useEffect(() => {
_subscribeProvider();
return () => _removeLocationProvider();
}, []);
const _subscribeProvider = async () => {
const { status } = await Location.getForegroundPermissionsAsync();
if (status === "granted") {
// todo something
} else {
// todo something
}
location = await Location.watchPositionAsync(
{
accuracy: Location.Accuracy.Balanced,
timeInterval: 1000,
enableHighAccuracy: true,
distanceInterval: 2,
},
(location) => {
setLocation(location)
}
);
};
Platform: IOS, Android
SDK Versioun: currently