You are viewing an old version of this page. View the current version.
(v 3.1.1 and Newer of Location SDK-Android)
The following guide provides complete instructions and code snippets for the SDK integration for your Android LBS (Mapping) experience in your apps.
*If you are using version 3.0.0 - 3.1.0 of the Android Location SDK, view Integrating a Location Provider
*If you are using a version of the Location SDK for Android earlier than 3.0.0 contact Phunware Support for SDK assistance (email@example.com).
Android Location SDK 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 includes 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
Your App Id, Access Key, Signature Key and Encryption Key are found on the MaaS portal on the Applications tab.
See: Config Guides - Core
Step 5 - Add MapFragment to your layout
This is 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:
The PhunwareMapManager is created and the Phunware API keys are registered in this step.
Then the MapFragment is located and the map is loaded asynchronously.
Your implementation of OnPhunwareMapReadyCallback will be called when the map is ready.
Step 7 - Make sure your activity implements
Once the PhunwareMap is ready, set it in the PhunwareMapManager and add a building by id.
Building additions are also asynchronous, so a callback will notify you of success or failure.
Step 8 - Do something interesting with the Building
Once the map and building are loaded, move and zoom the view so you can see the initial floor.
Integrating a Managed Provider
Managed Providers offer a combination of signal location providers. This combination results in higher accuracy rates for location in dynamic way finding.
Phunware Managed Providers:
|Cisco Beacon Point|
Cisco vBLE (virtual bluetooth low energy) location provider
|Mist||Mist vBLE (virtual bluetooth low energy) location 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.