Hi,
So, let me start here:
It seems that while sleeping, not only my app but other background apps also get suspended together. Investigating users' screenshots of system settings-battery page, every 'Screen Idle' app gets suspended at some point (mostly while sleeping) and audio stops after that.
The thing to understand here is that what you're describing is a relatively high level "user issue" ("Audio stopped playing"), not what actually occurred on the device. At a high leve, all three of these cases will look exactly the same ("audio stopped"):
-
The device rebooted to install an update.
-
The app was killed to install an app update.
-
The app was interrupted and failed to resume properly.
...but #3 is the only one that your app can really address.
That does lead me to a follow up question on this point:
The problem is that my app sometimes gets suspended
Do you specifically KNOW that your app was suspended (not terminated)? It's easy to be imprecise about terminology but the distinction is important here. There are lots of reasons an app might stop running "overnight" but most of what the system does would specifically mean that it terminated the app entirely, not just suspended it.
Moving to here:
I've found this issue from several reports from users. Sometimes it also occurs on my phone too, though I don't know the exact method to replicate it.
If you want to dig into this "in depth", then you basically need two things:
-
A sysdiagnose that cover the time the failure was taken, ideally without a user reboot having occurred since the problem happened.
-
(ideally) Log data from your app so you can determine when the failure actually happened.
If you have #2, then this is basically a matter of opening up the console log (from inside #1), finding that time in the log, then reading through the log to see "what happened". The system generates pretty clear logging for app suspension/termination and you'll also be able to see it "reacting" if your app crashes. Without #2, some investigation is still possible, but it's more work since you'll be looking at much larger time window trying to find a specific failure.
The app is using mixable audio mode since some users want to listen to music simultaneously. Therefore, I am not going to use 'Now playing' as you mentioned.
OK.
__
Kevin Elliott
DTS Engineer, CoreOS/Hardware