private LocationManager loc;
private String provider;
public Location location;
loc = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
provider=LocationManager.NETWORK_PROVIDER;
location = loc.getLastKnownLocation(provider);
if (location != null) {
int lati = (int) location.getLatitude();
int longi = (int) location.getLongitude();
}