From bf4889a4f86a0f76a552fccba7a42f843aee8fec 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: [PATCH] Fix "You're trying to build a job with no constraints, this is not allowed." error when starting a JobService on Android < Q. (cherry picked from commit 5d1466b5498eb2be7ff8c0ad5983e2833ad15115) --- .../infinityforreddit/services/DownloadMediaService.java | 1 + .../infinityforreddit/services/DownloadRedditVideoService.java | 1 + .../infinityforreddit/services/EditProfileService.java | 1 + .../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 6ef5b92170..75dc884d87 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 static JobInfo constructJobInfo(Context context, long contentEstimatedByt .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 9bf0aa2bd1..13da3088e6 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 static JobInfo constructJobInfo(Context context, long contentEstimatedByt .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 fc25add74f..aaf9da4e40 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 static JobInfo constructJobInfo(Context context, long contentEstimatedByt .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 13e2015f5d..8a42847db4 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 static JobInfo constructJobInfo(Context context, long contentEstimatedByt .build(); } else { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, SubmitPostService.class)) + .setOverrideDeadline(0) .setExtras(extras) .build(); }