I am developing an application which uses location services. I know how to check if location service is available with isProviderEnabled method of LocationManager class. I checked all three services like this
LocationManager loma=(LocationManager)context.getSystemService(Context.LOCATION_SERVICE);
if(loma.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
loma.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME, MIN_DISTANCE, this);
//do stuff
}
if(loma.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
loma.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_TIME, MIN_DISTANCE, this);
//do stuff
}
if(loma.isProviderEnabled(LocationManager.PASSIVE_PROVIDER)) {
loma.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, MIN_TIME, MIN_DISTANCE, this);
//do stuff
}
But I do not know how test it. Even though I closed location services in my phone and genymotion everything works like location is on. Is there anyone know how to test this?
Aucun commentaire:
Enregistrer un commentaire