The app gets shut down after some time

Hi! I listen to pods at work with AntennaPod, and after some time the app gets shut down entirely, so I have to restart it and play from where it stopped. This started happening recently and was not a problem before. I have turned off battery optimization in Android settings. What could be the reason?

Motorola Moto x4 with Android 9

Do you stream or download the episodes first?

I think both? I see it downloading sometimes at home, but outside home I might stream episodes that aren’t downloaded

And when does it stop exactly?
There is a known issue when steaming, meanwhile downloading and then leaving the internet connection (like WLAN), the Playback doesn’t switch to the downloaded file and just stops, is that what’s happening?

Maybe you can try to write some concrete steps on how to reproduce this issue, like what do you do exactly so that the issue occurs?

At work (where there’s no wi-fi) I have a queue of podcasts I listen to. I think they’re streaming rather than having been downloaded beforehand (how can I find out?). After listening for some time - it seems to be random - playback stops and the app has been shut down (it’s no longer in tabs or what it’s called), so I have to start it again and start playback again.

Does it say anything interesting on the “report bug” screen on the settings page?

No, there’s nothing there . . .

I reinstalled with default settings. Streamed an episode and now it just stopped playback, saying “Downloading data for podcast. Service shutting down.” (in the phone’s pulldown menu)

I am seeing the same behavior on my Moto g6 Plus phone, also running Android 9.

It happens like clockwork: around the 40 minute mark of every podcast I listen to, downloaded or streamed, the app abruptly crashes.

I reopen the app, click on the podcast I’m listening to, and it continues from the point where it exited.

If there is any additional info I can supply, please let me know; would love to see this fixed. I have been using this app for about three weeks now and find it otherwise outstanding in every way.

Actually you could, go to settings and the second last option “report bug” should give you a stacktrace (a lot of complicated looking lines) please copy it and post it here :slight_smile:

Environment

Android version: 11
OS version: 4.9.264-gc0d4f4d3b726-ab7315855
AntennaPod version: 2.3.0-beta3
Model: Pixel 3a XL
Device: bonito
Product: bonito

Crash info

Time: 04-07-2021 11:59:14
AntennaPod version: 2.3.0-beta3

StackTrace

java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@8be3bce rejected from java.util.concurrent.ScheduledThreadPoolExecutor@e8c6aef[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 1559]
	at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2086)
	at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:848)
	at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:334)
	at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(ScheduledThreadPoolExecutor.java:629)
	at de.danoeh.antennapod.core.service.playback.PlaybackServiceTaskManager.startPositionSaver(SourceFile:173)
	at de.danoeh.antennapod.core.service.playback.PlaybackService$2.onPlaybackStart(SourceFile:959)
	at de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer.setPlayerStatus(SourceFile:326)
	at de.danoeh.antennapod.core.service.playback.PlaybackServiceMediaPlayer.setPlayerStatus(SourceFile:337)
	at de.danoeh.antennapod.core.service.playback.LocalPSMP.resumeSync(SourceFile:338)
	at de.danoeh.antennapod.core.service.playback.LocalPSMP.lambda$resume$3$LocalPSMP(SourceFile:310)
	at de.danoeh.antennapod.core.service.playback.-$$Lambda$LocalPSMP$qJO6fE9RrQzc5jd_fVqGKQZ-MqQ.run(Unknown Source:2)
	at de.danoeh.antennapod.core.service.playback.LocalPSMP$PlayerExecutor.submit(SourceFile:87)
	at de.danoeh.antennapod.core.service.playback.LocalPSMP.resume(SourceFile:308)
	at de.danoeh.antennapod.core.service.playback.LocalPSMP$1.lambda$onAudioFocusChange$0$LocalPSMP$1(SourceFile:892)
	at de.danoeh.antennapod.core.service.playback.-$$Lambda$LocalPSMP$1$bWQm-SvHzg-23xcSmeXJeDjoCno.run(Unknown Source:4)
	at de.danoeh.antennapod.core.service.playback.LocalPSMP$PlayerExecutor.submit(SourceFile:87)
	at de.danoeh.antennapod.core.service.playback.LocalPSMP$1.onAudioFocusChange(SourceFile:876)
	at android.media.AudioManager$ServiceEventHandlerDelegate$1.handleMessage(AudioManager.java:3749)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:201)
	at android.os.Looper.loop(Looper.java:288)
	at android.app.ActivityThread.main(ActivityThread.java:7796)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:974)

Ah we had that one before https://github.com/AntennaPod/AntennaPod/pull/5145

I’ve checked three times now, and none of these times when I’ve restarted the app is their a stack trace available. My provisional conclusion is that the app is not crashing per se, but some external process is closing it. But what could that be?

Some vendors make crappy modifications to Android trying to save battery that don’t follow Google’s specs (see https://dontkillmyapp.com) but I have not seen that from Motorola yet. Did you try adding an exception from battery optimization?

What cbrace is describing is about exactly what I have experienced. Battery opt. is turned off.