I'm Trying to use the getCurrentGeolocation() function. NO MATTER WHAT I DO IT DOESN'T WORK! I tried calling the function from different pages and the function doesn't return any error or nothing! It just doesn't work, there is no response.
here is the code I use:
// For full API documentation, including code examples, visit http://wix.to/94BuAAs import wixWindow from 'wix-window'; $w.onReady(function () { //TODO: write your page related code here... wixWindow.getCurrentGeolocation() .then( (obj) => { let timestamp = obj.timestamp; // 1495027186984 let latitude = obj.coords.latitude; // 32.0971036 let longitude = obj.coords.longitude; // 34.774391099999995 let altitude = obj.coords.altitude; // null let accuracy = obj.coords.accuracy; // 29 let altAccuracy = obj.coords.altitudeAccuracy; // null let heading = obj.coords.heading; // null let speed = obj.coords.speed; // null console.log(timestamp); console.log(longitude); } ) .catch( (error) => { let errorMsg = error; }); });
Please help me solve this issue! Thank you!
What isn't working? I copied your code and tried it myself and it works fine.