fazlurr
7/9/2014 - 9:09 AM

Get current location (Lattitude and Longitude) - http://stackoverflow.com/questions/2227292/how-to-get-latitude-and-longitude-of-the-mobiled

private final LocationListener locationListener = new LocationListener() {
    public void onLocationChanged(Location location) {
        longitude = location.getLongitude();
        latitude = location.getLatitude();
    }
}

lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2000, 10, locationListener);
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double longitude = location.getLongitude();
double latitude = location.getLatitude();
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />