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
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);
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();
}
...
}