Integrating a BLE Location Provider
In order to show the user's current location, we will need to add a Location Provider to provide updated location information.
Here's a brief summary of the location providers Phunware provides:
|Senion Lab BLE location provider|
|Cisco MSE location provider|
|GPS location provider|
Below are the steps for integrating a BLE Location Provider with your app.
Step 1 - Add a location provider as a compile dependency.
Step 2 - Set the Location Provider and Enable Location Updates
This step tells the PhunwareMapManager what provider will be used to get location updates. In this case, the Senion Location Provider requires a customer id and map id. The method getSenionFloorMap() returns a HashMap of Senion floor ids to MaaS floor ids.
It's important to note that you must pass a building object to the setLocationManager() method on PhunwareMapManager.
The call to setMyLocationEnabled() allows you to control when the blue dot is rendered.
Step 3 - Manage Location Updates when in the Background
Constant location updates when in the background will drain a battery. In order to prevent this, we intercept activity lifecycle methods to disable and enable location updates.