Hi there!
Is there a possibility to get device location (GPS coordinates) using a specific action ?
Thanks
Hi there!
Is there a possibility to get device location (GPS coordinates) using a specific action ?
Thanks
Hi,
Not with a specfic action, but you can use Run Code and the geoLocation API to do this.
I have a Run Code action node with two actions defined as Action Params:
Inside the Run Code action node:
const options = {
enableHighAccuracy: true,
timeout: Infinity,
maximumAge: 0,
};
function success(pos) {
const crd = pos.coords;
setCurrentPosistion({ long: crd.longitude, lat: crd.latitude })
.then(resolve())
.catch((err) => {
error(err)
})
.finally(() => { setLoading({ isLoading: false }) });
}
function error(err) {
console.warn(`ERROR(${err.code}): ${err.message}`);
setLoading({ isLoading: false });
reject(err)
}
setLoading({ isLoading: true })
navigator.geolocation.getCurrentPosition(success, error, options);
You can read more about how to use Run Code in our docs
// Erik