anytime_podcast_player icon indicating copy to clipboard operation
anytime_podcast_player copied to clipboard

Application get sometimes killed during playback

Open Chralu opened this issue 1 year ago • 2 comments

This is related to #120

Describe the bug

When playing a podcast, OS may decide to kill AnytimePodcast after a while.

Logs on Android

12-23 09:43:12.858  1494 10583 W ActivityManager: Background started FGS: Disallowed [callingPackage: uk.me.amugofjava.anytime; callingUid: 10170; uidState: SVC ; intent: Intent { cmp=uk.me.amugofjava.anytime/com.ryanheise.audioservice.AudioService }; code:DENIED; tempAllowListReason:<null>; targetSdkVersion:34; callerTargetSdkVersion:34; startForegroundCount:1; bindFromPackage:null]
12-23 09:43:12.874  1494 10583 W ActivityManager: startForegroundService() not allowed due to mAllowStartForeground false: service uk.me.amugofjava.anytime/com.ryanheise.audioservice.AudioService
12-23 09:44:08.080  1494  1710 W ActivityManager: Stopping service due to app idle: u0a170 -26m55s672ms uk.me.amugofjava.anytime/com.ryanheise.audioservice.AudioService
12-23 09:53:15.764  1494  1710 I ActivityManager: Killing 13748:uk.me.amugofjava.anytime/u0a170 (adj 700): excessive cpu 61690 during 300001 dur=607700 limit=10
12-23 09:53:16.055  1494  2110 I WindowManager: WIN DEATH: Window{c66c7df u0 uk.me.amugofjava.anytime/com.ryanheise.audioservice.AudioServiceActivity}
12-23 09:53:16.055  1494  1614 I MediaSessionStack: removeSession | record: uk.me.amugofjava.anytime/media-session (userId=0)
12-23 09:53:16.095  1494  1709 W UsageStatsService: Unexpected activity event reported! (uk.me.amugofjava.anytime/com.ryanheise.audioservice.AudioServiceActivity event : 23 instanceId : 107590840)

Smartphone :

  • iPhone 8 (iOS 16)
  • Fairphone3 (Android 13)

Chralu avatar Dec 23 '24 09:12 Chralu

It looks like https://stackoverflow.com/questions/77219713/flutter-just-audio-abruptly-stops-when-in-the-background-after-around-10-minutes

Chralu avatar Dec 23 '24 09:12 Chralu

One of the suggested resolutions was to use the audio_service package in order to obtain a foreground service, which Anytime does use.

When you pause an episode it does make Anytime eligible for killing. I think this is fine, but what Anytime needs to do is be better at recovering. Often it will show the episode that was playing before being killed, but not always.

amugofjava avatar Dec 28 '24 12:12 amugofjava