Reverse geocoding example


This sample demonstrates how to obtain current GPS position and converts it into an address. Functions used are GetActualGpsPosition and GetLocationInfo.


                import com.sygic.sdk.remoteapi.ApiLocation;
                import com.sygic.sdk.remoteapi.ApiNavigation;
                import com.sygic.sdk.remoteapi.model.GpsPosition;
                import com.sygic.sdk.remoteapi.exception.GpsException;
                import com.sygic.sdk.remoteapi.exception.InvalidLocationException;
		    	String strCurrAddress = "";
		    	try {
		    	    boolean satInfo = true;
		    	    int maxTime = 0;
		    	    GpsPosition gpsPos = new GpsPosition();
		    	    gpsPos = ApiNavigation.getActualGpsPosition(satInfo, maxTime);
		    	    Position pos = new Position();
		    	    pos.setPosition(gpsPos.getLongitude(), gpsPos.getLatitude());
		    	    strCurrAddress = ApiLocation.getLocationAddressInfo(pos, maxTime);
		    	} catch (GpsException e) {
		    		Log.e("GpsPosition", "Error code:"+ e.getCode());
		    	} catch (InvalidLocationException e) {
		    		Log.e("Location", "Error code:"+ e.getCode());
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request