Navigation Data
[Navinfo Navigation SDK for Adnroid] provides the corresponding interface to return navigation data, including: current car position (latitude and longitude), current head direction, current speed, current road name, current route length, route remaining Time, current steering ID, recommended map display scale and other data. All results are called back in the onNaviSessionEvent(int event, java.lang.Object data) method in the NaviSession.EventHandl interface. For specific reference examples:
// Data callback during navigation new NaviSession.EventHandler () { public void onNaviSessionEvent (int event, Object data) { switch (event) { case NaviSession.Event. tracking: Logger.d (TAG, "Vehicle moving"); // TODO: Something else // This event is the NaviSessionData object. For this object, see the NaviSessionData information. NaviSessionData d = (NaviSessionData)data; Double distance=d. d.turnIconProgress; //Get the distance to the next road Float speed=d.speed; //Get the current speed Short newCarOri=d.carOri; //Get the current direction of the car, in degrees. The positive east is 0, and the counterclockwise direction is positive, that is, the true north is: 90, the positive west is: 180, and the positive south is: 270. String roudName=d.roadName; //Get the name of the road currently driving Int iconId=d.turnIcon; //Get the icon id of the current turn Point carPoint=d.carPos; //Get the current position coordinates Int newMapScale = d.suggestedMapScale; //Get the current scale // Get the desired action after getting the data break; } } }