diff --git a/JobScheduler/DeepBackground/build.gradle b/JobScheduler/DeepBackground/build.gradle
index 12fdbe7ca..ebc21f615 100644
--- a/JobScheduler/DeepBackground/build.gradle
+++ b/JobScheduler/DeepBackground/build.gradle
@@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.3.0-beta1'
+ classpath 'com.android.tools.build:gradle:1.3.0-beta2'
}
}
@@ -14,14 +14,24 @@ dependencies {
}
android {
-// compileSdkVersion 22
compileSdkVersion 'android-MNC'
- buildToolsVersion "23.0.0 rc1"
+ buildToolsVersion "23.0.0 rc2"
defaultConfig {
- minSdkVersion 'MNC'
-// minSdkVersion 15
-// targetSdkVersion 22
- targetSdkVersion 'MNC'
+ minSdkVersion 15
+ targetSdkVersion 15
+ }
+
+ // based on http://stackoverflow.com/a/27372806/115145
+
+ applicationVariants.all { variant ->
+ variant.outputs.each { output ->
+ output.processManifest.doLast {
+ def manifestOutFile = output.processManifest.manifestOutputFile
+ def newFileContents = manifestOutFile.getText('UTF-8').replace("MNC", "15")
+ manifestOutFile.write(newFileContents, 'UTF-8')
+ }
+ }
}
}
+
diff --git a/JobScheduler/DeepBackground/src/main/java/com/commonsware/android/deepbg/PollReceiver.java b/JobScheduler/DeepBackground/src/main/java/com/commonsware/android/deepbg/PollReceiver.java
index 20e55f91f..858414173 100644
--- a/JobScheduler/DeepBackground/src/main/java/com/commonsware/android/deepbg/PollReceiver.java
+++ b/JobScheduler/DeepBackground/src/main/java/com/commonsware/android/deepbg/PollReceiver.java
@@ -23,6 +23,7 @@
import android.os.SystemClock;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
+import java.lang.reflect.Field;
public class PollReceiver extends WakefulBroadcastReceiver {
static final String EXTRA_PERIOD="period";
@@ -46,7 +47,7 @@ public void onReceive(Context ctxt, Intent i) {
}
}
- @TargetApi(Build.VERSION_CODES.KITKAT)
+ @TargetApi(Build.VERSION_CODES.MNC)
static void scheduleExactAlarm(Context ctxt, AlarmManager alarms,
long period, boolean isDownload) {
Intent i=buildBaseIntent(ctxt)
@@ -54,6 +55,16 @@ static void scheduleExactAlarm(Context ctxt, AlarmManager alarms,
.putExtra(EXTRA_IS_DOWNLOAD, isDownload);
PendingIntent pi=PendingIntent.getBroadcast(ctxt, 0, i, 0);
+ Log.e("PollReceiver", String.valueOf(Build.VERSION.SDK_INT));
+ Log.e("PollReceiver", String.valueOf(Build.VERSION_CODES.LOLLIPOP_MR1));
+// Log.e("PollReceiver", String.valueOf(Build.VERSION.PREVIEW_SDK_INT));
+ Log.e("PollReceiver", String.valueOf(putMarzipanInYourPiePlateBingo()));
+
+ if (putMarzipanInYourPiePlateBingo()) {
+ Log.e("PollReceiver", "allow while idle");
+ alarms.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP,
+ SystemClock.elapsedRealtime() + period, pi);
+ }
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.KITKAT) {
alarms.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP,
SystemClock.elapsedRealtime() + period, pi);
@@ -70,7 +81,7 @@ static void scheduleInexactAlarm(Context ctxt, AlarmManager alarms,
PendingIntent pi=PendingIntent.getBroadcast(ctxt, 0, i, 0);
alarms.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
- SystemClock.elapsedRealtime()+period, period, pi);
+ SystemClock.elapsedRealtime() + period, period, pi);
}
static void cancelAlarm(Context ctxt, AlarmManager alarms) {
@@ -89,4 +100,26 @@ static boolean doesPendingIntentExist(Context ctxt) {
.getBroadcast(ctxt, 0, buildBaseIntent(ctxt),
PendingIntent.FLAG_NO_CREATE)!=null);
}
+
+ static private boolean putMarzipanInYourPiePlateBingo() {
+ boolean result=false;
+
+ if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP_MR1) {
+ try {
+ Field f=Build.VERSION.class.getField("PREVIEW_SDK_INT");
+
+ if (f.getInt(null)>0) {
+ result=true;
+ }
+ }
+ catch (NoSuchFieldException e) {
+ // no problem, must really be API 22
+ }
+ catch (IllegalAccessException e) {
+ // ummm... this shouldn't happen
+ }
+ }
+
+ return(result);
+ }
}
diff --git a/JobScheduler/DeepBackground/src/main/res/layout/main.xml b/JobScheduler/DeepBackground/src/main/res/layout/main.xml
index 676287326..ee47247ed 100644
--- a/JobScheduler/DeepBackground/src/main/res/layout/main.xml
+++ b/JobScheduler/DeepBackground/src/main/res/layout/main.xml
@@ -8,73 +8,59 @@
android:useDefaultMargins="true">
+ android:layout_row="0"
+ android:layout_weight="1"/>
+ android:layout_row="1"
+ android:layout_weight="1"/>
+ android:layout_row="2"
+ android:layout_weight="1"/>
+ android:layout_row="3"
+ android:layout_weight="1"/>
\ No newline at end of file
diff --git a/JobScheduler/DeepBackground/src/main/res/values/arrays.xml b/JobScheduler/DeepBackground/src/main/res/values/arrays.xml
index dac6d3e3e..6e2ba83c6 100644
--- a/JobScheduler/DeepBackground/src/main/res/values/arrays.xml
+++ b/JobScheduler/DeepBackground/src/main/res/values/arrays.xml
@@ -1,14 +1,14 @@
-
- - Exact Alarm
- - Inexact Alarm
- - JobScheduler
-
-
- - 1 Minute
- - 15 Minutes
- - 30 Minutes
- - 60 Minutes
-
+
+ - Exact Alarm
+ - Inexact Alarm
+ - JobScheduler
+
+
+ - 1 Minute
+ - 15 Minutes
+ - 30 Minutes
+ - 60 Minutes
+
\ No newline at end of file