Will "NETWORK_PROVIDER" work on epad (zinglife) to get latitude and longitude of the place. It has only wifi connection. No sim is present. Also will it fetch location name if I am using geocoder. In short do I need sim to use NETWORK_PROVIDER ?
Device : epad (zinglife) Android OS
wi-fi : Yes
Internet : Yes
Sim : No sim
Code Sample :
lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0,0, this);
Location location=lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
geocoder = new Geocoder(this);
if(location!=null)
onLocationChanged(location);
public void onLocationChanged(Location location) {
try {
List<Address> addresses geocoder.getFromLocation(location.getLatitude(),location.getLongitude(), 2); // <10>
for (Address address : addresses) {
tv.setText(address.getAddressLine(0));
}
catch(Exception e){
e.printstacktrace;
}