From 76147a9be735a24f37c778124e2f40075e3c5540 Mon Sep 17 00:00:00 2001 From: Ken Swenson Date: Fri, 24 Jul 2020 22:25:10 -0400 Subject: [PATCH] fix: Download on WiFi regardless of metered status (#3489) * fix: Download on WiFi regardless of metered status fixes #3395 * fix: check if not WiFi rather than checking if connection is mobile --- .../java/eu/kanade/tachiyomi/data/download/DownloadService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt index 6b3dda2995..d0e6278635 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadService.kt @@ -4,6 +4,7 @@ import android.app.Notification import android.app.Service import android.content.Context import android.content.Intent +import android.net.ConnectivityManager import android.net.NetworkInfo.State.CONNECTED import android.net.NetworkInfo.State.DISCONNECTED import android.os.Build @@ -143,7 +144,7 @@ class DownloadService : Service() { private fun onNetworkStateChanged(connectivity: Connectivity) { when (connectivity.state) { CONNECTED -> { - if (preferences.downloadOnlyOverWifi() && connectivityManager.isActiveNetworkMetered) { + if (preferences.downloadOnlyOverWifi() && connectivityManager.activeNetworkInfo?.type != ConnectivityManager.TYPE_WIFI) { downloadManager.stopDownloads(getString(R.string.download_notifier_text_only_wifi)) } else { val started = downloadManager.startDownloads()