diff --git a/build.gradle b/build.gradle
index 4fda442b5..d2e7786b6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,13 +7,10 @@ task wrapper(type: Wrapper) {
buildscript {
repositories {
jcenter()
- maven {
- url 'https://maven.google.com'
- }
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
+ classpath 'com.android.tools.build:gradle:2.3.2'
}
}
@@ -37,6 +34,9 @@ android {
versionName "4.9.13"
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ jackOptions {
+ enabled true
+ }
}
signingConfigs {
@@ -46,6 +46,7 @@ android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
+ incremental false
}
buildTypes {
@@ -114,9 +115,7 @@ dependencies {
annotationProcessor "com.jakewharton:butterknife-compiler:${BUTTERKNIFE_VERSION}"
compile "com.jakewharton:butterknife:${BUTTERKNIFE_VERSION}"
- debugCompile ("com.facebook.stetho:stetho:${STETHO_VERSION}") {
- exclude group: 'com.google.code.findbugs', module: 'jsr305'
- }
+ debugCompile "com.facebook.stetho:stetho:${STETHO_VERSION}"
debugCompile "com.facebook.stetho:stetho-timber:${STETHO_VERSION}@aar"
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
//noinspection GradleCompatible
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index eea9cb8d1..5f341bd12 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -461,6 +461,14 @@
android:name=".jobs.ReminderJob"
android:exported="false" />
+
+
+
+
PendingIntent getPendingIntent(Class c) {
+ private PendingIntent getPendingBroadcast(Class c) {
+ return PendingIntent.getBroadcast(context, 0, new Intent(context, c), 0);
+ }
+
+ private PendingIntent getPendingService(Class c) {
return PendingIntent.getService(context, 0, new Intent(context, c), 0);
}
}
diff --git a/src/main/java/org/tasks/jobs/ReminderJob.java b/src/main/java/org/tasks/jobs/ReminderJob.java
index 34ae6419f..f40b9234d 100644
--- a/src/main/java/org/tasks/jobs/ReminderJob.java
+++ b/src/main/java/org/tasks/jobs/ReminderJob.java
@@ -1,5 +1,7 @@
package org.tasks.jobs;
+import android.content.Intent;
+
import com.todoroo.astrid.reminders.ReminderService;
import org.tasks.Notifier;
@@ -8,7 +10,7 @@ import org.tasks.preferences.Preferences;
import javax.inject.Inject;
-public class ReminderJob extends Job {
+public class ReminderJob extends WakefulJob {
public static final String TAG = "job_reminder";
@@ -38,4 +40,9 @@ public class ReminderJob extends Job {
protected void scheduleNext() {
reminderService.scheduleNextJob();
}
+
+ @Override
+ protected void completeWakefulIntent(Intent intent) {
+ ReminderJobBroadcast.completeWakefulIntent(intent);
+ }
}
diff --git a/src/main/java/org/tasks/jobs/ReminderJobBroadcast.java b/src/main/java/org/tasks/jobs/ReminderJobBroadcast.java
new file mode 100644
index 000000000..ce75fa74b
--- /dev/null
+++ b/src/main/java/org/tasks/jobs/ReminderJobBroadcast.java
@@ -0,0 +1,12 @@
+package org.tasks.jobs;
+
+import android.content.Context;
+import android.content.Intent;
+import android.support.v4.content.WakefulBroadcastReceiver;
+
+public class ReminderJobBroadcast extends WakefulBroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ startWakefulService(context, new Intent(context, ReminderJob.class));
+ }
+}
diff --git a/src/main/java/org/tasks/jobs/WakefulJob.java b/src/main/java/org/tasks/jobs/WakefulJob.java
new file mode 100644
index 000000000..b2b486b60
--- /dev/null
+++ b/src/main/java/org/tasks/jobs/WakefulJob.java
@@ -0,0 +1,18 @@
+package org.tasks.jobs;
+
+import android.content.Intent;
+
+public abstract class WakefulJob extends Job {
+
+ public WakefulJob(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void onHandleIntent(Intent intent) {
+ super.onHandleIntent(intent);
+ completeWakefulIntent(intent);
+ }
+
+ protected abstract void completeWakefulIntent(Intent intent);
+}