slightly refactor agpDownloaded

This commit is contained in:
sonora 2015-04-12 11:01:26 +02:00
parent b4465ea22d
commit 88b63fb7fe

View file

@ -104,8 +104,11 @@ public class OsmAndLocationProvider implements SensorEventListener {
private OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS;
private OsmandPreference<Boolean> USE_FILTER_FOR_COMPASS;
private static final long AGPS_TO_REDOWNLOAD = 16 * 60 * 60 * 1000; // 16 hours
private boolean agpsDownloaded = false;
public boolean agpsDownloaded = false;
public boolean agpsDownloaded() {
return agpsDownloaded;
}
public class SimulationProvider {
@ -227,7 +230,6 @@ public class OsmAndLocationProvider implements SensorEventListener {
if(time - app.getSettings().AGPS_DATA_LAST_TIME_DOWNLOADED.get() > AGPS_TO_REDOWNLOAD) {
//force an updated check for internet connectivity here before destroying A-GPS-data
if(app.getSettings().isInternetConnectionAvailable(true)) {
agpsDownloaded = false;
redownloadAGPS();
if(agpsDownloaded == true) {
app.getSettings().AGPS_DATA_LAST_TIME_DOWNLOADED.set(time);
@ -262,6 +264,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
}
public void redownloadAGPS() {
agpsDownloaded = false;
try {
final LocationManager service = (LocationManager) app.getSystemService(Context.LOCATION_SERVICE);
service.sendExtraCommand(LocationManager.GPS_PROVIDER,"delete_aiding_data", null);