diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-07-25 17:31:14 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-07-25 17:31:14 +0000 |
commit | 72f5380212eae32ca1fb242d8b663530168b0734 (patch) | |
tree | 3165898ab1d68b22c9fecd3a4a85926712285ca4 /app/src/main | |
parent | 1322dd288ed7574a3e5a99dfb1a975f46234555e (diff) | |
download | infinity-for-reddit-72f5380212eae32ca1fb242d8b663530168b0734.tar infinity-for-reddit-72f5380212eae32ca1fb242d8b663530168b0734.tar.gz infinity-for-reddit-72f5380212eae32ca1fb242d8b663530168b0734.tar.bz2 infinity-for-reddit-72f5380212eae32ca1fb242d8b663530168b0734.tar.lz infinity-for-reddit-72f5380212eae32ca1fb242d8b663530168b0734.tar.xz infinity-for-reddit-72f5380212eae32ca1fb242d8b663530168b0734.tar.zst infinity-for-reddit-72f5380212eae32ca1fb242d8b663530168b0734.zip |
Add NetworkCapabilities.NET_CAPABILITY_INTERNET in required network in JobService.
Diffstat (limited to 'app/src/main')
4 files changed, 8 insertions, 4 deletions
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 970cea53..8d008539 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadMediaService.java @@ -14,6 +14,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.media.MediaScannerConnection; +import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; @@ -87,7 +88,7 @@ public class DownloadMediaService extends JobService { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, DownloadMediaService.class)) .setUserInitiated(true) - .setRequiredNetwork(new NetworkRequest.Builder().build()) + .setRequiredNetwork(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build()) .setEstimatedNetworkBytes(0, contentEstimatedBytes + 500) .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 6fa3e22d..54ec726e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/DownloadRedditVideoService.java @@ -18,6 +18,7 @@ import android.media.MediaExtractor; import android.media.MediaFormat; import android.media.MediaMuxer; import android.media.MediaScannerConnection; +import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; @@ -96,7 +97,7 @@ public class DownloadRedditVideoService extends JobService { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, DownloadRedditVideoService.class)) .setUserInitiated(true) - .setRequiredNetwork(new NetworkRequest.Builder().build()) + .setRequiredNetwork(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build()) .setEstimatedNetworkBytes(0, contentEstimatedBytes + 500) .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 d1e2e81f..a9d2105c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/EditProfileService.java @@ -8,6 +8,7 @@ import android.content.ComponentName; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; @@ -76,7 +77,7 @@ public class EditProfileService extends JobService { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, EditProfileService.class)) .setUserInitiated(true) - .setRequiredNetwork(new NetworkRequest.Builder().build()) + .setRequiredNetwork(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build()) .setEstimatedNetworkBytes(0, contentEstimatedBytes + 500) .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 6be41292..6b13ce72 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/services/SubmitPostService.java @@ -8,6 +8,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Bitmap; +import android.net.NetworkCapabilities; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; @@ -122,7 +123,7 @@ public class SubmitPostService extends JobService { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { return new JobInfo.Builder(JOB_ID++, new ComponentName(context, SubmitPostService.class)) .setUserInitiated(true) - .setRequiredNetwork(new NetworkRequest.Builder().build()) + .setRequiredNetwork(new NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build()) .setEstimatedNetworkBytes(0, contentEstimatedBytes + 500) .setExtras(extras) .build(); |