Android LocationManager他的网络提供商赢得了';使不能

Android LocationManager他的网络提供商赢得了';使不能,android,locationmanager,android-location,Android,Locationmanager,Android Location,我尝试从wifi获取位置时遇到问题。它在GPS上工作,我尝试以相同的方式获取位置,但在调试器中,可以看到isNetworkEnabled始终为false。 如何修复此错误 // getting GPS status, this works isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status, this stays on FALSE is

我尝试从wifi获取位置时遇到问题。它在GPS上工作,我尝试以相同的方式获取位置,但在调试器中,可以看到isNetworkEnabled始终为false。 如何修复此错误

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

// getting network status, this stays on FALSE
isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
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"/>


有些手机发射塔不提供定位服务,所以可能就是这样。您还需要在设备的位置设置中通过网络和wifi启用位置估计,如下所示:

您应该查看融合的位置提供商。它自动化了这一过程,很可能您所在的位置没有来自wifi的任何位置数据,或者没有足够的范围内基站来提供三角测量以获取您的位置