You are viewing an old version of this page. View the current version.
Version 1 Next »
Way Finding (Static and Dynamic) Integrations
The following guide provides complete instructions and code snippets for the SDK integration for your Android LBS (Mapping) experience in your apps.
The first three sections are for both Routing and (static and dynamic way finding).
The last two sections are for Blue Dot (dynamic way finding or turn-by-turn).
Android Installation - Getting Started
This guide is a quick start to adding a Phunware Map to an Android app. Android Studio is the recommended development environment for building an app with the Phunware Mapping SDK.
Step 1- Add the Phunware Maven remote repository.
Insert this block into
Step 2 - Add the Mapping SDK as a dependency in your app's
This one line will also pull in all dependencies necessary to use the Phunware Mapping SDK.
Step 3 - Add your Google Maps Api Key to
Create a string resource that contains your Google Maps API Key.
If you need help getting a Google Maps API Key, please find instructions here: Get a Google Maps API key
Step 4 - Add Phunware keys for App Id, Access Key, Signature Key and Encryption Key
The App Id, Access Key, Signature Key and Encryption Key are found on the MaaS portal.
Step 5 - Add MapFragment to your layout
This is the fragment where the Phunware Mapping SDK will render the map. Note the fragment will be found via the R.id.map id.
Step 6 - Get the Map asynchronously in your activity:
Here, we are creating the PhunwareMapManager and registering the Phunware API keys.
Next, we find the MapFragment and have it load the map asynchronously. Our implementation of OnPhunwareMapReadyCallback will be called when the map is ready.
Step 7 - Make sure your activity implements
Once the PhunwareMap is ready, we set it in the PhunwareMapManager and then add a building by id. Adding a building is also asynchronous, so we provide a callback to be notified of success and failure.
Step 8 - Do something interesting with the Building
Once the map and building are loaded, move and zoom the camera so we can see the initial floor.
Getting POI info from a Map Marker
The Mapping SDK associates a PointOptions object with its associated Google map marker object.
When setting up InfoWindow click listeners, you can access the POI info from the marker by calling the getTag() method on the marker and cast it to PointOptions.
Using a MapView in a Custom Layout
MapView is a subclass of the Google Maps MapView class. It can be used to place a map in any Android View.
Users of the MapView class must forward all the activity life cycle methods to the corresponding methods in the MapView class. Examples of these methods include onCreate(), onDestroy(), onResume() and onPause().
Dynamic Way Finding Signal Provider Integrations
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.
Phunware's location providers:
|Senion Lab BLE location provider|
|Cisco Hyperlocation location provider|
|GPS location provider|
NOTE: Additional providers, Beacon Point and Mist are integrated as as Managed Providers.
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.
Integrating a Managed Provider
Step 1 - Add the Phunware Maven remote repository. Insert this block into
Step 2 - Add Phunware key resources to strings.xml for App Id, Access Key, Signature Key
Navigate to portal, find your app, and add your access key and signature key to setup your application.
Step 3 - Add Phunware keys for App Id, Access Key, and Signature Key to Manifest
Note that encryption key may not be provided in portal under your app's settings. If it isn't, you may leave it empty.
Step 4 - Add managed provider as a compile dependency.
Step 5 - Set the Location Provider on the PhunwareMapManager
It's important to note that Managed Provider must be built and set on my MapManager after the the map is ready and the building has been loaded.
There are a few values that will be needed to build a ManagedProvider, they are as follows:
- application: reference to the users application
- context: Context of the application
- venueId: Id of the venue/building you currently have loaded
- (optional) Senion values
- slCustomerId: The customer ID provided by Senion
- slMapKey: the map key provided by senion
- (optional) Beacon Point values
- bpOrgId: the orgId provided by Beacon Point
Step 6 - Enable Location Updates
Enable location updates after we have the map and building as well as after setting the provider
Step 7 - Manage Location Updates when in the Background
In order to ensure that we handle lifecycles correctly we must stop requesting location updates when we background, and begin requesting them when we are in the foreground.