Switching locations with the Meridian SDK Follow
Overview
This article discusses switching locations when using the Meridian SDK and 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.
SDK Overview
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.
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).
Example
One thing to consider when switching Meridian Locations is creating a UI that makes it clear to the user that they are switching Locations.
The following screenshot shows a hypothetical application that allows users to navigate among many different HPE Locations. It allows users to select a Location when launching the application and switch to a different Location while in the application.
At launch, it 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, the app loads the home page for the new Location and re-initializes the map with the new Location.
Comments
0 comments
Article is closed for comments.