The steps below describe how to configure the NavigationKit Android SDK with your app. For reference purposes, it may be useful to refer to a fully-built reference application that has these steps completed already. You may use this reference application as a starting point for a new app that uses this SDK. The steps below are appropriate for adding the SDK to an existing app.
Note that these steps assume your app is set up as a project in Android Studio 1.0+.
Download the NavigationKit aar file from here and place it in a lib folder. Drag and drop the .aar file into your Android Studio Project’s “libs” folder. This should be next to your “src” folder. If there is no “libs” folder, create one.
Add the following lines to your gradle.build file in the same folder as the lib folder.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.radiusnetworks:navigationkit-android:0+@aar'
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
The NavigationKit.properties files is specific to your app’s NavigationKit setup. It will be provided to you by Radius Networks. Copy the NavigationKit.properties file into the /src/main/resources folder of your project. Most likely, you will have to create this folder yourself. Please note that this is NOT to be confused with the /src/main/res folder.
The Navigation Kit system will automatically download your map images from a server when your app starts up. For faster startup and to allow the app to work right away without internet connectivity, you may bundle these maps and additional configuration in your app. To do this, place your map image files and your map_config.json (provided by Radius Networks) in a /src/main/assets folder. You will need to create this folder if it is not there.
MapView
class into your app.In order to display your map, simply create an Activity that displays a MapView
and
configure it to use your map identifier. A full example of this is provided in the reference application, but the code below shows the basics:
private MapView mMapView;
...
NavigationKitManager navigationKitManager = NavigationKitManager.getInstanceForApplication(mContext);
mMapView = new MapView(this.mContext);
((FrameLayout)rootView.findViewById(R.id.webview_layout)).addView(mMapView);
mMapView.loadMap(navigationKitManager.findMap("V1")); // Dispay the map with id "V1"
In Android Studio, build and run your app. In order to see your position on the map, you will need to turn on beacons with the same identifiers configured with your NavigationKit on the server.