Navmii Turn-by-Turn SDK
Write yourself a navigation system in Android
Navmii Turn-by-Turn SDK for Android
Note
This is a pre-release version of the SDK and its quality does not reflect the quality of the final product.

The turn-by-turn navigation SDK is a cross-platform toolkit that allows you to create your own navigation system with a custom set of features, look, and behavior.

This documentation describes the event based API for the Java language. All SDK functionality is represented with NavmiiControl and NavmiiSettings classes

NavmiiControl initialization example

MainActivity.java

public class MainActivity extends Activity implements
NavmiiControl.ReverseLookupCallback,
NavmiiControl.ControlEventListener,
NavmiiControl.RouteEventsListener,
NavmiiControl.MapControlEventListener,
NavmiiControl.UserItemsOnMapEventListener,
NavmiiControl.OnRouteEventListener,
NavmiiControl.TrafficJamOnRouteEventListener,
NavmiiControl.HudEventsListener
{
private NavmiiControl navigationSystem;
...
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
consoleView = (TextView)findViewById(R.id.caption);
trafficJamView = (ImageView)findViewById(R.id.trafficJam);
// uncomment to disable touches on map
//findViewById(R.id.mapHUD).setClickable(true);
File externalStorage = Environment.getExternalStorageDirectory();
resourcePath = externalStorage.getAbsolutePath() + "/navmii-assets";
navigationSystem = ExampleApplication.getNavigationSystem();
navigationSystem.setResourcePath(resourcePath);
navigationSystem.start();
mMapView = (MapView) findViewById(R.id.mapFragment);
mMapView.setNavmiiControl(getNavmiiControl());
mMapView.onCreate();
try {
String navigationSystemClassName = "geolife.android.navigationsystem.NavigationSystem";
Class<?> navigationSystemClass = Class.forName(navigationSystemClassName);
Method getPrivateApiMethod = navigationSystemClass.getMethod("getPrivateApi");
privateApi = (NavmiiPrivateApi) getPrivateApiMethod.invoke(navigationSystem);
}
catch (Exception e) {
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
navigationSystem.addControlEventListener(this);
navigationSystem.addMapControlEventListener(this);
navigationSystem.addItemsOnMapEventListener(this);
navigationSystem.addOnRouteEventListener(this);
navigationSystem.addTrafficJamOnRouteEventListener(this);
navigationSystem.addHudEventsListener(this);
navigationSystem.addRouteEventsListener(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
navigationSystem.removeControlEventListener(this);
navigationSystem.removeMapControlEventListener(this);
navigationSystem.removeItemsOnMapEventListener(this);
navigationSystem.removeOnRouteEventListener(this);
navigationSystem.removeTrafficJamOnRouteEventListener(this);
navigationSystem.removeHudEventsListener(this);
navigationSystem.removeRouteEventsListener(this);
mMapView.onDestroy();
navigationSystem.destroy();
}
@Override
protected void onStart() {
super.onStart();
mMapView.onStart();
navigationSystem.resume();
}
@Override
protected void onStop() {
super.onStop();
mMapView.onStop();
navigationSystem.pause();
}
@Override
protected void onResume() {
super.onResume();
mMapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
mMapView.onPause();
}
...
}

Layout.xml

<SurfaceView
android:id="@+id/mapSurface"
android:layout_below="@id/trafficJam"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />