Use JobScheduler to make the "WiFi-only" feature work properly newer Android versions.

I'm considering dropping support for KitKat, as we have now double the code for the same feature.
This commit is contained in:
2017-08-19 08:17:52 +02:00
parent 858651e808
commit 852e38b97d
14 changed files with 211 additions and 93 deletions

View File

@ -17,10 +17,12 @@
package ch.dissem.apps.abit.dialog;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import ch.dissem.apps.abit.R;
import ch.dissem.apps.abit.util.NetworkUtils;
import ch.dissem.apps.abit.util.Preferences;
/**
@ -36,12 +38,16 @@ public class FullNodeDialogActivity extends Activity {
@Override
public void onClick(View view) {
Preferences.setWifiOnly(FullNodeDialogActivity.this, false);
NetworkUtils.enableNode(getApplicationContext());
finish();
}
});
findViewById(R.id.dismiss).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
NetworkUtils.scheduleNodeStart(getApplicationContext());
}
finish();
}
});