Can I retrieve GPS location in App Maker

414 views Asked by At

Is there a way to retrieve GPS location from a device in an App Maker app?

I'm trying to create a "checkin" app for my users. I want to retrieve their GPS location (lattitude, longitude) when they submit their "checkin".

1

There are 1 answers

0
Tony BenBrahim On

Yes, you can, on a Chrome browser, see https://developers.google.com/web/fundamentals/native-hardware/user-location/ for all the details.

if (navigator.geolocation){
  navigator.geolocation.getCurrentPosition(function(position){
    console.log(position.coords.latitude, position.coords.longitude);
  });
}

The user must consent to disclosing their location.