List of Locations (Flex AppBlock)

Overview

This type of Flex AppBlock will allow you to create and manage a list of locations, which includes the latitude and longitude coordinates of each location, shown in order of proximity to the App User.

You can import your locations using a CSV file.

By default, using the List of Locations list type in your Flex AppBlock will return the location closest to the app user. The app user will be prompted to enable their location access settings on their mobile device if it is not already turned on.  The user may also use their zip code if preferred. 

 

CSV File

To make your List of Locations work as expected, you must do a few things in addition to the normal CSV file requirements:

  • You must have a column named "Latitude".
  • You must have a column named "Longitude".

Here is a sample CSV with locations: List of Locations (Flex AppBlock)

 

Configuration

On the Configuration page, you can limit the number of items (locations) shown to the app user.  It is set to "no limit" by default.

You can also limit the number of items (locations) shown to only those within a certain distance of the app user.  It is set to "no limit" by default.

 

Data Mapping

When you go to Data Mapping, you will notice that the Latitude and Longitude fields are not shown.

If you want to include a Map View, be sure to check "Use as Title on Map View" for one of the fields.

 

Canvases

When you are designing the List View or Detail View canvas, you will see an additional field called "Proximity" in the My Content tab of the Tool Box.  In the app, this field will display the distance between the content item (based on Latitude and Longitude) and the app user's current location (based on the device's location services).
**NOTE: When you add the Proximity field to the canvas, it will only display "1.00 mi" for the first item and "Proximity" for all others - don't worry!  This is simply due to the fact that the MobileSmith platform itself does not have the ability to detect your location.

 

Location Services

 

 

On a device, the first time the user goes to an AppBlock that can use location, it will ask to use location services.  If the user agrees, then the List of Locations AppBlock can determine the user's distance from each item in the list.

 

 

Map List Items

When designing the List View canvas, you will see an additional action button "Map List Items" in the Actions tab of the Tool Box.  This allows the app user to view a map with a pin in each location.

 

 

Map List Items on iPhone


 

 

When the app user taps the Map List Items action button, the app will use the device's default map service to show a map with a pin for every item in the list.

Display Map as Default View

Once you've added the Map List Items action button, you can click it to configure it.  It is set to use the default icon, but you can also opt to use simple text or an image from your Image Library.  You will also see a checkbox labeled "Display map as default view for this AppBlock?" - if this is checked, when the app user navigates to this AppBlock, it will show the Map View first.  If you leave it unchecked, it will show the List View first.

 

Here is what the sequence of pages will look like when you have set the map as the default view: (in this example, there is a Menu List with a button targeting the List of Locations AppBlock)

 

 

Use as Title on Map View

If you checked "Use as Title on Map View" for one of the fields in Data Mapping, that field will be shown when the app user taps on a pin:

 

Directions

When designing the Detail View canvas, you will see an additional action button "Directions" in the Actions tab of the Tool Box.  This allows the app user to get directions to that item.  You can drag the button onto the canvas or the navbar.

 

 


Get Directions on iPhone


 

When the app user taps the Directions action button, the app will use the device's default map service to show directions from the user's current location to the item.

Location Settings

The first time the app user goes to an AppBlock that uses Location, the app will ask for permission to to use the device's location.  Once the user picks an answer, the app will not ask again.  If the user wants to change his answer, he will need to use the device's default Settings app.

 

 

On iPhone, launch the Settings app.

On the Settings page, scroll down to find your app and tap it.

On your app's page, tap the Location row.

On your app's Location Settings page, you can select how the app should use your location.

 

If the app user chooses "Allow", the app's location setting will be "While Using the App".

 

If the app user chooses "Don't Allow", the app's location setting will be "Never".