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

Before You Begin

  • Ensure you have generated your Google API Key

  • Know about Magic Text

  • You will need a paid Adalo plan to use this feature.

  • Note that each time your app requests user location, your Google plan may be charged.

Walkthrough

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.

Requesting Permission

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.

Accessing User Location

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.

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.

Learn More

  • 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.

  • Check out our course in the App Academy about using Location.

Help

If you need additional help with this article, you can always ask in our community forum! Be sure to paste the link to this article in your post as well!

Last updated