我有一个我使用的应用程序isProviderEnabled(LocationManager.NETWORK_PROVIDER
但是当我将此应用程序放入 Samsung Galaxy Young 时,即使在“设置”中启用了false
该选项,它也会始终返回。Packet Data
为什么会出错?
这是我的代码的一部分:
boolean isNetworkEnabled = false;
locationManager = (LocationManager) c
.getSystemService(this.c.LOCATION_SERVICE);
// getting network status
isNetworkEnabled = locationManager
.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
Toast.makeText(c.getApplicationContext(), "Obteniendo network provider = "+isNetworkEnabled, Toast.LENGTH_SHORT).show();
if (isNetworkEnabled) {
Log.i(LOGTAG, "obtiene localizaciones de network provider NET.... ");
ret = 0;
LocationManager lm = (LocationManager) c
.getSystemService(c.LOCATION_SERVICE);
myloc = null;
myloc = new mylocationlistener();
LocationListener locationListener = myloc;
Log.i(LOGTAG, "myloc.... latitude=" + myloc.getLatitude()
+ " Longitude=" + myloc.getLongitud());
Toast.makeText(c.getApplicationContext(), "conectandose AGPS...lat = "+myloc.getLatitude()+ " Longitud = "+myloc.getLongitud(), Toast.LENGTH_SHORT).show();
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,
locationListener);
} else {
ret = -1;
}