Follow

Navigate to address example

Description

This sample shows how to start navigation to an input address. The address is first translated to GPS coordinates by the API geocoding function locationFromAddress and subsequently the navigation is started through startNavigation.

Java

                import com.sygic.sdk.remoteapi.Api;
                import com.sygic.sdk.remoteapi.ApiLocation;
                import com.sygic.sdk.remoteapi.ApiNavigation;
                import com.sygic.sdk.remoteapi.exception.GeneralException;
                ...
		    	try {
		    	    String address = "SVK,Bratislava,Einsteinova,18";
		    	    boolean postal = false;
		    	    boolean fuzzyMatch = true;
		    	    Position pos = ApiLocation.locationFromAddress(address, postal, fuzzyMatch, 0);
		    	    int flags = 0;
		    	    boolean searchAddress = false;
		    	    WayPoint wp = new WayPoint();
		    	    wp.SetLocation(pos.getX(), pos.getY());
		    	    ApiNavigation.startNavigation(wp, flags, searchAddress, 0);

		    	} catch (GeneralException e) {
		    	    Log.e("Navigation", "Error code:"+ e.getCode());
		    	}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments