slightly refactor agpDownloaded
This commit is contained in:
parent
b4465ea22d
commit
88b63fb7fe
1 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue