Find POI on Route example


This example demonstrates how to find some petrol stations within the driving time interval.
Such a function is typically used to support a rest planning, i.e. this function delivers the set of POIs reachable arround the required rest stop time.
Please note this function is only available with Sygic 3D navigation.


import com.sygic.sdk.remoteapi.Api;
import com.sygic.sdk.remoteapi.exception.GeneralException;
import com.sygic.sdk.remoteapi.model.Poi;
import com.sygic.sdk.remoteapi.ApiPoi;
    int minutes = 90;                     // number of minutes to drive to the planned stop
    int minDriveTime = minutes*60 - 600;  // lower bound driving time in seconds for the POI search
    int maxDriveTime = minutes*60 + 600;  // upper bound driving time in secndds for the POI search
    int maxTime = 0;                      // maximum time function can take, 0 for no time limitation
    ArrayList pois = ApiPoi.getPoiOnRoute(-1, ApiPoi.PETROL_STATION, minDriveTime, maxDriveTime, maxTime);
    if (pois.size() > 0)
       Position pos = pois.get(0).getLocation();
       WayPoint wp = new WayPoint();
       wp.SetLocation(pos.getX(), pos.getY());
       ApiNavigation.startNavigation(wp, 0, false, maxTime);
catch (GeneralException e) {
    Log.e("PoisOnRoute", "Error code:" + e.getCode());
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request