diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-01-06 14:36:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 14:36:11 +0100 |
commit | 849bf4ad854973d39698613c3a356c09c87e687c (patch) | |
tree | fbd07d17fe5f26b8c91f9ce4ff8020046070431f /app/src/main/java/de/danoeh/antennapod/receiver | |
parent | 8252eb2183c6a478fdfd9317586c8800a24054ca (diff) | |
download | AntennaPod-849bf4ad854973d39698613c3a356c09c87e687c.zip |
Rewrite download request creation (#5530)
Android has a limit on the size of Intent parameters. When enqueuing
a huge number of items, it just ignored the argument and did not call
onNewIntent. We now load the list over in DownloadService.
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/receiver')
3 files changed, 5 insertions, 11 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java b/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java index 020f4374b..8cb5a7cdf 100644 --- a/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java +++ b/app/src/main/java/de/danoeh/antennapod/receiver/ConnectivityActionReceiver.java @@ -7,7 +7,6 @@ import android.net.ConnectivityManager; import android.text.TextUtils; import android.util.Log; - import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.util.NetworkUtils; diff --git a/app/src/main/java/de/danoeh/antennapod/receiver/PowerConnectionReceiver.java b/app/src/main/java/de/danoeh/antennapod/receiver/PowerConnectionReceiver.java index 339a4f0f7..34ce83489 100644 --- a/app/src/main/java/de/danoeh/antennapod/receiver/PowerConnectionReceiver.java +++ b/app/src/main/java/de/danoeh/antennapod/receiver/PowerConnectionReceiver.java @@ -7,8 +7,8 @@ import android.util.Log; import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.preferences.UserPreferences; +import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.storage.DBTasks; -import de.danoeh.antennapod.core.storage.DownloadRequester; // modified from http://developer.android.com/training/monitoring-device-state/battery-monitoring.html // and ConnectivityActionReceiver.java @@ -37,7 +37,7 @@ public class PowerConnectionReceiver extends BroadcastReceiver { // if we're not supposed to be auto-downloading when we're not charging, stop it if (!UserPreferences.isEnableAutodownloadOnBattery()) { Log.d(TAG, "not charging anymore, canceling auto-download"); - DownloadRequester.getInstance().cancelAllDownloads(context); + DownloadService.cancelAll(context); } else { Log.d(TAG, "not charging anymore, but the user allows auto-download " + "when on battery so we'll keep going"); diff --git a/app/src/main/java/de/danoeh/antennapod/receiver/SPAReceiver.java b/app/src/main/java/de/danoeh/antennapod/receiver/SPAReceiver.java index 5981d3d67..d1636dcff 100644 --- a/app/src/main/java/de/danoeh/antennapod/receiver/SPAReceiver.java +++ b/app/src/main/java/de/danoeh/antennapod/receiver/SPAReceiver.java @@ -11,9 +11,9 @@ import java.util.Arrays; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.ClientConfig; +import de.danoeh.antennapod.core.service.download.DownloadService; +import de.danoeh.antennapod.core.service.download.DownloadRequestCreator; import de.danoeh.antennapod.model.feed.Feed; -import de.danoeh.antennapod.core.storage.DownloadRequestException; -import de.danoeh.antennapod.core.storage.DownloadRequester; /** * Receives intents from AntennaPod Single Purpose apps @@ -44,12 +44,7 @@ public class SPAReceiver extends BroadcastReceiver{ ClientConfig.initialize(context); for (String url : feedUrls) { Feed f = new Feed(url, null); - try { - DownloadRequester.getInstance().downloadFeed(context, f); - } catch (DownloadRequestException e) { - Log.e(TAG, "Error while trying to add feed " + url); - e.printStackTrace(); - } + DownloadService.download(context, false, DownloadRequestCreator.create(f).build()); } Toast.makeText(context, R.string.sp_apps_importing_feeds_msg, Toast.LENGTH_LONG).show(); } |