Comment on page
Getting the User's Location
You can access the user's location so they can save their travels or compare distances with other addresses.
Skill Level: Intermediate
NOTE: A user's location is not continuously updated on the backend. The device location only updates whenever they take an action (create, update, etc.) that uses their location. Thus, a map marker is not able to be "tracked" like you might see with Uber or Doordash.
1.) Before you can start access a user's location, the app must first ask for their permission to do so. You can have the app request permission manually by adding a Click Action to any component, hovering Location, then clicking Request Permission. It's usually best to have this action either on screen load or when the user first tries to access location or map features of your app.
HINT: If you forget to set this action up or decide not to, Adalo will ask the user automatically the first time their location is requested by the app.
You can access the user's location through Magic Text in two different ways:
1.) Selecting the Current Device Location as with the Location Input component, form components, and other areas where you need to fill in a Location property specifically.
Selecting the Current Device Location as the default location for a Location Input Component
Selecting the Current Device Location as part of a Create Action to set the Location property (Destination) of a new Trip.
2.) Selecting the Current Device Location's > individual data properties such as full address, zip code, latitude, longitude, etc. by hovering over the Current Device Location > itself and choosing the piece of data you need. This is for filling in fields that are not location property types.
Setting a map's marker address to the Current Device Location's Full Address
- A user's location is not continuously updated. User device location is only pulled when they take an action in the app that uses their location (create, update, etc.). Thus, the user is not able to be tracked the way you might track your Uber driver or Doordash delivery.
- Getting device location works on Android, iOS, PWAs, and desktop web apps.