diff options
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(); |