Follow

Get ETA and Distance example

Description

This sample demonstrates how to obtain ETA and the distance to finish on the currently calculated route. They key function here is the API function getRouteInfo followed by getEstimatedTimeArrival and getRemainingDistance.

Java

                
import com.sygic.sdk.remoteapi.Api;
import com.sygic.sdk.remoteapi.ApiNavigation;
import com.sygic.sdk.remoteapi.model.RouteInfo;
...
String strETA = "";
int distanceToFinish = 0;
try {
   RouteInfo info = ApiNavigation.getRouteInfo(false, 0);
   RouteInfo.RouteInfoTime eta = info.getEstimatedTimeArrival();
   strETA = String.valueOf(eta);
   distanceToFinish = info.getRemainingDistance();
} catch (GeneralException e) {
   Log.e("RouteInfo",  "Error code:"+ e.getCode());
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments