Find Nearby POI example


This example demonstrates how to find the nearest petrol station around a given location (Karadzicova, Bratislava, Slovakia) and start navigating to it.


                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;
		    	    ArrayList<Poi> mPois = new ArrayList<Poi>(); // arraylist to which we nearby POIs of petrol station category
		    	    int id = 201;              // ID for petrol station category
		    	    String category = "null";  // identifier for custom POIs
		    	    int x = 1712518;           // longitude of Karadzicova, Bratislava, Slovakia
		    	    int y = 4815014;           // latitude of Karadzicova, Bratislava, Slovakia
		    	    int maxTime = 0;           // maximum time function can take, 0 for no time limitation
		    	    int maxCount = 10;
		    	    mPois = ApiPoi.findNearbyPoiList(id, category, x, y, maxCount, maxTime);
		    	    int flags = 0;
		    	    boolean searchAddress = false;
		    	    Position pos = mPois.get(0).getLocation();
		    	    WayPoint wp = new WayPoint();
		    	    wp.SetLocation(pos.getX(), pos.getY());
		    	    ApiNavigation.startNavigation(wp, flags, searchAddress, maxTime);
		    	catch (GeneralException e) {
		    		Log.e("FindPoi", "Error code:" + e.getCode());
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request