Getting User's Location from Mobile Device

We don’t have native support for this in Anvil yet, but you can request access to the user’s location from Javascript:
https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation

You could then use anvil.call() to call from Javascript into Anvil (quick-and-dirty guide here) to share the user’s location.

(Ideally, I would create a custom component that sets up a callback in Javascript via watchPosition(), and then raises an event with the latitude and longitude.)

1 Like