From a0ac39e403fcded7bd926722f61d687dbb4431a3 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 11 Jul 2021 11:12:37 +0200 Subject: [PATCH] Ignore refresh when there is no network --- .../antennapod/core/util/download/AutoUpdateManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java b/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java index a8ca43ccb..bb0a71744 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java @@ -20,6 +20,7 @@ import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.FeedUpdateWorker; import de.danoeh.antennapod.core.storage.DBTasks; +import de.danoeh.antennapod.core.util.NetworkUtils; public class AutoUpdateManager { private static final String WORK_ID_FEED_UPDATE = "de.danoeh.antennapod.core.service.FeedUpdateWorker"; @@ -118,6 +119,10 @@ public class AutoUpdateManager { */ public static void runImmediate(@NonNull Context context) { Log.d(TAG, "Run auto update immediately in background."); + if (!NetworkUtils.networkAvailable()) { + Log.d(TAG, "Ignoring: No network connection."); + return; + } new Thread(() -> DBTasks.refreshAllFeeds( context.getApplicationContext(), true), "ManualRefreshAllFeeds").start(); }