0

I have a problem when i try to get the location from wifi. It's working on GPS and i try to get the location on the same way but in the debugger is see that isNetworkEnabled is always on false. How can i fix this bug?

// getting GPS status, this works
isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

// getting network status, this stays on FALSE
isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

The AndroidManifest:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
     Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Shereef Marzouk
  • 3,282
  • 7
  • 41
  • 64

1 Answers1

0

Some cell towers dont provide a location service so it may just be that. You also need to enable location estimation through network and wifi in the Location settings of your device as shown here: isProviderEnabled(LocationManager.NETWORK_PROVIDER) return false

Community
  • 1
  • 1
CarbonAssassin
  • 855
  • 12
  • 24
  • It's likely you may be in a location which doesn't have any location data from the wifi or enough in range cell towers to provide triangulation to get your location – CarbonAssassin Apr 27 '14 at 15:09