Posts

Showing posts with the label Geolocation

Android: How To Initialize A Variable Of Type "Location" (other Than Making It Equal To Null)

Answer : The API documentation is quite clear on this. First create a new Location instance: Location loc = new Location("dummyprovider"); And then use the setter methods to set the location parameters you need, e.g.: loc.setLatitude(20.3); loc.setLongitude(52.6); Location object = new Location("service Provider"); it will create an object of Type Location that contains the initial Latitude and Longitude at location '0' to get the initial values use double lat = object.getLatitude(); double lng = object.getLongitude(); In Kotlin using LocationManager class you can pass the required location provider like: val location = Location(LocationManager.NETWORK_PROVIDER) // OR GPS_PROVIDER based on the requirement location.latitude = 42.125 location.longitude = 55.123

Address Validation Using Google Maps API

Answer : The answer probably depends how critical it is for you to receive support and possible customization for this service. Google can certainly do this. Look into their XML and Geocoding API's. You should be able to craft an XML message asking Google to return Map coordinates for a given address. If the address is not found (invalid), you will receive an appropriate response. Here's a useful page: http://code.google.com/apis/maps/documentation/services.html#XML_Requests Note that Google's aim in providing the Maps API is to plot addresses on actual maps. While you can certainly use the data for other purposes, you are at the mercy of Google should one of their maps not exactly correspond to your legal or commercial address validation needs. If you paid for one of the services you mentioned, you would likely be able to receive support should certain addresses not resolve the way you expect them to. In other words, you get what you pay for ;) . If you have the t...