Posts

Showing posts with the label getting the location from android devices

Getting The Current Location from the Android device Also getting the address from that location

hey guys in this tutorial i will show u guys how to get the location from your android device and find the address of the location from that device. please add these permissions public class LocationFinder implements LocationListener { Context context; Double lat, lon; Location location; public LocationFinder(Context c) { this.context = c; LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 10, 1000 * 60 * 1, this); try { location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); setLat(location.getLatitude()); setLon(location.getLongitude()); }catch (Exception e){ Toast.makeText(c,"couldn't locate your location",Toast.LENGTH_LONG).show(); setLat(21.0000); ...