Closed ishaqueahmed-mev closed 4 years ago
Hi @ishaqueahmed-mev. Using this plugin at its current state, you cannot call the geolocation.watchLocation()
API with a configuration for a guaranteed interval of time between each location updates in iOS. I can suggest you two ways to go to make the refreshes less in number:
updateDistance
option to the geolocation.watchLocation()
API call. This way location updates will be received when more significant changes in the location of the device occur. Read more on distanceFilter
in iOS here.geolocation.getCurrentLocation()
API:To start watching:
let intervalId = setInterval(() => {
console.log("Getting current location ...");
geolocation.getCurrentLocation({
desiredAccuracy: Accuracy.high,
maximumAge: 5000,
timeout: 10000
}).then(function (loc) {
if (loc) {
model.locations.push(loc);
}
}, function (e) {
console.log("Error: " + (e.message || e));
});
}, 60000); // 1 minute interval
To stop watching:
clearInterval(intervalId);
I hope this helps.
:wave: @ishaqueahmed-mev, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please, use Stackoverflow to get help.
@tbozhikov, thanks for the response. I'll try the second one as I need to receive update every 60 secs, irrespective of location change.
Thanks
Hello,
I have been using watchLocation method from the plugin to receive the update of location, but it sends updates almost every second or two. I want it to give update every 60 seconds, but I am not getting how to set it, something like updateTime in android, which is ignored in iOS.
Any help would be much appreciated.
Thanks