Calculating distance between two geographic locations

http://developer.android.com/reference/android/location/Location.html Look into distanceTo Returns the approximate distance in meters between this location and the given location. Distance is defined using the WGS84 ellipsoid. or distanceBetween Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. Distance and bearing are defined using the … Read more

window.location.href and window.open () methods in JavaScript

window.location.href is not a method, it’s a property that will tell you the current URL location of the browser. Changing the value of the property will redirect the page. window.open() is a method that you can pass a URL to that you want to open in a new window. For example: window.location.href example: window.location.href=”http://www.google.com”; //Will … Read more

How to get complete address from latitude and longitude?

Geocoder geocoder; List<Address> addresses; geocoder = new Geocoder(this, Locale.getDefault()); addresses = geocoder.getFromLocation(latitude, longitude, 1); // Here 1 represent max location result to returned, by documents it recommended 1 to 5 String address = addresses.get(0).getAddressLine(0); // If any additional address line present than only, check with max available address lines by getMaxAddressLineIndex() String city = addresses.get(0).getLocality(); … Read more

Location Services not working in iOS 8

I ended up solving my own problem. Apparently in iOS 8 SDK, requestAlwaysAuthorization (for background location) or requestWhenInUseAuthorization (location only when foreground) call on CLLocationManager is needed before starting location updates. There also needs to be NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription key in Info.plist with a message to be displayed in the prompt. Adding these solved my … Read more

How do I get the current GPS location programmatically in Android?

I have created a small application with step by step description to get current location’s GPS coordinates. Complete example source code is in Get Current Location coordinates , City name – in Android. See how it works: All we need to do is add this permission in the manifest file: <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” /> And create … Read more