Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d293bd66ef |
@@ -132,17 +132,22 @@ public abstract class SdkService extends Service {
|
||||
* A listener that deactivates the service when the upload completes.
|
||||
*/
|
||||
public Observer<Boolean> uploadListener = new Observer<Boolean>() {
|
||||
/** The previous state of the upload. */
|
||||
private boolean initialized = false;
|
||||
@Override
|
||||
public void onChanged(Boolean uploading) {
|
||||
if (currentState == State.IDLE) {
|
||||
if (uploading) {
|
||||
channelManager.updateNotification(R.string.mowesta_sdk_notification_content_upload);
|
||||
} else {
|
||||
} else if (initialized) {
|
||||
channelManager.updateNotification(R.string.mowesta_sdk_notification_content_idle);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
// shutdown the service, the alarm manager will do the rest
|
||||
Log.d(TAG, "Stopping service and let alarm manager do the rest.");
|
||||
stopSelf();
|
||||
}
|
||||
} else {
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,9 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
public void execute() {
|
||||
start = SystemClock.elapsedRealtime();
|
||||
readBattery();
|
||||
System.out.println("Battery");
|
||||
readScreen();
|
||||
System.out.println("Screen");
|
||||
// add sensor listeners
|
||||
SensorManager manager = (SensorManager)context.getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
|
||||
if (manager != null) {
|
||||
@@ -147,6 +149,7 @@ public class MeasureTask extends AsyncTask<Void, Void, Void> {
|
||||
registerSensor(manager, Sensor.TYPE_PRESSURE, "SENSOR_PRESSURE");
|
||||
registerSensor(manager, Sensor.TYPE_RELATIVE_HUMIDITY, "SENSOR_HUMIDITY");
|
||||
}
|
||||
System.out.println("Manager");
|
||||
this.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ allprojects {
|
||||
|
||||
// set version for our project
|
||||
group = 'com.mowesta'
|
||||
version = '1.0.1-SNAPSHOT'
|
||||
version = '1.0.2'
|
||||
|
||||
// set versions for our libraries
|
||||
ext {
|
||||
|
||||
Reference in New Issue
Block a user