Fix elevation api updates and refresh onResume
rodzic
21e0fb19b7
commit
6c0ecc972f
|
|
@ -335,14 +335,11 @@ public class DataCollector implements Runnable {
|
|||
public void onResume() {
|
||||
locationProvider.startLocationProvider(null);
|
||||
elapi.pause = false;
|
||||
if (elapi_thread != null)
|
||||
elapi_thread.interrupt();
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
elapi.pause = true;
|
||||
if (elapi_thread != null)
|
||||
elapi_thread.interrupt();
|
||||
locationProvider.stopLocationProvider();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public class ElevationApi implements Runnable {
|
|||
StringBuilder resp = new StringBuilder();
|
||||
for (String line; (line = br.readLine()) != null; resp.append(line));
|
||||
String data = resp.toString();
|
||||
|
||||
JSONObject json = new JSONObject(data);
|
||||
alt = json.getJSONArray("elevation").getInt(0);
|
||||
System.out.println("alt"+alt);
|
||||
|
|
@ -39,9 +40,11 @@ public class ElevationApi implements Runnable {
|
|||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
while (!Thread.currentThread().isInterrupted())
|
||||
do {
|
||||
Thread.sleep(30000);
|
||||
} while (pause);
|
||||
} catch (InterruptedException ignored) {}
|
||||
boolean ignored = Thread.interrupted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue