You should do something like this instead of LocationManager.GPS_PROVIDER
, use LocationManager.NETWORK_PROVIDER
LocationManager lManager = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("Network", "Network");
if (locationManager != null) {
location = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
System.out.println("latitude network" + latitude+"longi "+location.getLongitude());
if (latitude == 0.0) {
showSettingsAlertData();
}
}