Onproviderenabled Not Working?
For switching between GPS & Network location provider I just tried in a way like this, to identify when a provider is disabled switch to another, but my onProviderEnabled() is
Solution 1:
Define a location listener like the following:
LocationListener locationListener = newLocationListener() {
publicvoidonLocationChanged(Location location) {
}
publicvoidonProviderDisabled(String provider) {}
publicvoidonProviderEnabled(String provider) {}
publicvoidonStatusChanged(String provider, int status, Bundle extras) {}
};
Then :
LocationManagerlm= (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
Post a Comment for "Onproviderenabled Not Working?"