|
@@ -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()
|