We have a podcast player app, which works great on most phones, but some Samsung users are reporting that the stream stops playing when the screen turns off. We are using foreground services and notifications for playback with ExoPlayer.
After some investigation, it turns out that if you disable 'Put app to sleep' for our app in Settings -> Device Care -> Battery, it will work as expected.
Is it possible to automatically disable put app to sleep for our app?
I have read about the Samsung Knox API ApplicationPolicy.addPackageToBatteryOptimizationWhiteList()
, but that requires requesting device admin rights for our app, which would be scary for the users.