From 97afab67dbade584ea2ff3bcfa1981e82f1807e9 Mon Sep 17 00:00:00 2001 From: qinyin Date: Sun, 1 Jul 2018 20:44:02 +0200 Subject: [PATCH] Pause download service if no network (#783) * Add setupTableDrawerAdapter() function to simply KiwixMobileActivity.onCreate(). BUG: #565 * Pause DownloadService if network is not available * Revert changes to KiwixMobileActivity.java * Negation on the network availability condition. (cherry picked from commit 873218352f083c9d5dd2eff2f8cb597b52c33dbc) --- .../org/kiwix/kiwixmobile/downloader/DownloadService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/downloader/DownloadService.java b/app/src/main/java/org/kiwix/kiwixmobile/downloader/DownloadService.java index 7f610d9e2..e158002d3 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/downloader/DownloadService.java +++ b/app/src/main/java/org/kiwix/kiwixmobile/downloader/DownloadService.java @@ -142,8 +142,7 @@ public class DownloadService extends Service { if (intent == null) { return START_NOT_STICKY; } - String log = intent.getAction(); - log += " : "; + String log = intent.getAction() + " : "; if (intent.hasExtra(NOTIFICATION_ID)) { log += intent.getIntExtra(NOTIFICATION_ID, -3); } @@ -567,7 +566,8 @@ public class DownloadService extends Service { break; } - if (MainActivity.wifiOnly && !NetworkUtils.isWiFi(getApplicationContext())) { + if (MainActivity.wifiOnly && !NetworkUtils.isWiFi(getApplicationContext()) || + !NetworkUtils.isNetworkAvailable(getApplicationContext())) { pauseDownload(chunk.getNotificationID()); }