Turning on location in flows

You know what they say about business apps.. it’s all about location, location, location. ­čÖé If you like, you can turn on location settings in apps built with Flow. Based on the device (whether it has GPS, for example), turning on location populates the $User system value with geo-location details like current latitude/longitude or even current speed.

Here is how you can turn on location data for your apps:

  1. Create a new player. Give the player a name. For the sake of simplicity, let’s call the player Location in this example.
  2. Scroll down the code, till you come to the manywho.settings.initialize block (Ln 121 in this case).
  3. Time to add a couple of lines of code. These lines, to be exact:

    This is what the player code looks like now:
  4. Click Save to save the player. You will get a success message saying Player saved successfully.

Use this player to run the flow where you want location settings enabled. Here is one example:

Turning the location setting on will populate the following location-specific properties of the $User system value:

  • $User/Current Latitude
  • $User/Current Latitude
  • $User/Current Longitude
  • $User/Location Accuracy
  • $User/Current Altitude
  • $User/Altitude Accuracy
  • $User/Current Heading
  • $User/Current Speed
  • $User/Location Timestamp

NOTE: These values are device-dependent. For example, if a mobile phone does not have a GPS or an altimeter built in, some of these values will not be available.