From 5d1466b5498eb2be7ff8c0ad5983e2833ad15115 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:09:27 -0400 Subject: Fix "You're trying to build a job with no constraints, this is not allowed." error when starting a JobService on Android < Q. --- .../docilealligator/infinityforreddit/services/DownloadMediaService.java | 1 + .../infinityforreddit/services/DownloadRedditVideoService.java | 1 + .../docilealligator/infinityforreddit/services/EditProfileService.java | 1 + .../ml/docilealligator/infinityforreddit/services/SubmitPostService.java | 1 + 4 files changed, 4 insertions(+) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java index 6ef5b921..75dc884d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java @@ -95,6 +95,7 @@ public class DownloadMediaService extends JobService { .build(); } else { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, DownloadMediaService.class)) + .setOverrideDeadline(0) .setExtras(extras) .build(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java index 9bf0aa2b..13da3088 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java @@ -103,6 +103,7 @@ public class DownloadRedditVideoService extends JobService { .build(); } else { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, DownloadRedditVideoService.class)) + .setOverrideDeadline(0) .setExtras(extras) .build(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java index fc25add7..aaf9da4e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java @@ -83,6 +83,7 @@ public class EditProfileService extends JobService { .build(); } else { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, EditProfileService.class)) + .setOverrideDeadline(0) .setExtras(extras) .build(); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java index 13e2015f..8a42847d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java @@ -129,6 +129,7 @@ public class SubmitPostService extends JobService { .build(); } else { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, SubmitPostService.class)) + .setOverrideDeadline(0) .setExtras(extras) .build(); } -- cgit v1.2.3