This article discusses switching locations when using the Meridian SDK using the Aruba Campus application as an example.
This article assumes familiarity with the Meridian concepts of an Organization, Location, Building and Floor.
It’s easy to confuse the term Meridian Location, a collection of buildings and floors in the Meridian ecosystem, with a user’s location. A user’s location refers to an X/Y position on a Meridian Floor and a user’s GPS location refers to a latitude and longitude with respect to the global coordinate frame. In this document, Meridian Location is always capitalized.
The Meridian SDK is Location specific. This allows the user to quickly navigate around their Location while not downloading all of the data associated with an Organization. This should be sufficient for most use cases as a user is only physically in one Location.
If there is a need to switch the Location, the map needs to be re-initialized to the new Location, so the data associated with the new Location can be retrieved.
One thing to consider when switching Meridian Locations is creating a UI that makes it clear to the user that they are switching Locations.
Aruba Campus Example
Meridian publishes an application called Aruba Campus which enables wayfinding at all Aruba Meridian Locations. This allows Aruba employees to find co-workers and conference rooms at Aruba Meridian Locations worldwide. Campus allows users to select a Location when launching the application and switch to a different Location while in the application.
At launch, Campus checks the GPS location of the phone and if it is within a certain distance of a Meridian Location, that Location is automatically loaded. If the GPS location is not known or there are no close Locations, the Meridian Location picker (scrolling list) is displayed. Once a Location is loaded, there is a side menu that has the list of additional Locations. When a user selects a different Location, Campus loads the home page for the new Location and re-initializes the map with the new Location. Here is a screenshot of the Aruba Campus side menu:
Using GPS to select or switch locations
One option for using GPS to switch Meridian Locations is to find the closest Location to a user’s current position by measuring the distance between that position and the latitude and longitude of other Locations. Both iOS and Android provide helper routines for calculating that distance.
Another option for switching Meridian Locations based on GPS is to use geofencing. Both iOS and Android support notifying an application when a user is within a specified distance of a GPS location. Using this notification, the application could notify a user that they are in proximity of a new Meridian Location and offer to switch Locations for them. For more details on geofencing, see the following documentation (Android, iOS). In addition, here is a good tutorial on how to do geofencing (Android, iOS).