1

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;
}
Jeet
  • 115
  • 2
  • 13

3 Answers3

1

The google documentation says clearly "Android's Network Location Provider determines user location using cell tower and Wi-Fi signals,..." which should imply that it works without a SIM card if wifi is activated and the hotspots around are in the google database.

But.... I got location issues with one of the test devices while developing an App (sitting in an berlin office with >10 hotspots around). The only difference was the missing SIM. After some experiments with adding/removing SIM cards I could verify the behavior at least for Galaxy Nexus and Galaxy S3. I am shocked that this could indeed be true. To everyone: can you reproduce this?

locationManager.getProvider(LocationManager.NETWORK_PROVIDER).requiresCell()

Returns true on both Samsung devices.

Rodja
  • 7,998
  • 8
  • 48
  • 55
  • From my experience, sim cards were not needed for `locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);` – Akshat Agarwal Nov 15 '13 at 14:39
0

I have a 102sh (japan.softbank with normal sim) and galaxy nexus (no phone number, only data transmission limited sim).

I can get my address by getFromLocation on 102sh, but I can not get my address by getFromLocation on galaxy nexus.

So I think we need unlimited sim when we use getFromLocation.

j0k
  • 22,600
  • 28
  • 79
  • 90
shige
  • 1
0

You dont need a sim and you can get a location with permission ACCESS_COARSE_LOCATION.

Dany's
  • 943
  • 1
  • 7
  • 17
  • Do u have any link about this ? – Jeet Jan 06 '12 at 08:40
  • here is a complete access tutorial to location and google maps also:http://mobiforge.com/developing/story/using-google-maps-android – Dany's Jan 06 '12 at 08:43
  • Do u have any link that has any content about "we don't need sim" for this.The link u gave is tutorial of gps google map. – Jeet Jan 06 '12 at 08:49
  • checkout here http://stackoverflow.com/questions/4375913/get-latitude-and-longitude-without-inserting-sim-card-and-start-stop-gps-from-ap – Dany's Jan 06 '12 at 08:50
  • Now, where is written that they are using "network Provider". I am using only "network provider". – Jeet Jan 06 '12 at 09:03
  • i guarantee you..from personal experience...just give it a try and see if it works – Dany's Jan 06 '12 at 09:13