I have read most of the posts about ignore battery optimizations, many posts talk about extensions, I just want to know if there is any other way to ignore battery optimizations. My application is a webradio using exoplayer and when the device enters battery saving mode, the audio is turned off having to reopen the app. Helps are very appreciated!
There is an extension for that:
if you read my post, I need to know about any other way to ignore battery optimizations, and don’t use extensions
Sometimes you will need to use an extension in your project.Also, i think the extension is working properly, so you don’t need to think about another way to make it.Also i don’t know about any other way you can use.It looks like there isn’t any way except using the extension.
Do you know if it is possible to remove or modify the floating alert of the extension of the ignore battery optimizations that appears when starting the application?
May be @taifun can answer you as this is his extension
no, this option needs the confirmation of the user… probably the user prefers to keep the battery optimization? You will not be able to secretly stop optimizing battery usage.
The question of whether the Player or ExoPlayer component works in the background (idle / sleep mode) when the sound is streamed has often been discussed (in the Kodular and AI2 forum).
The answer is definitely no, at least not in all cases. With some Samsung devices in particular, it definitely does not work without using a Foreground service (not even with the Battery optimizations extension).
I have tested this intensively and extensively on dozens of devices and all Android versions and read almost every post in all relevant forums. We also discussed this topic in the AI2 Power User forum with the MIT team without a result / solution.
I have a Android phone using Android 10 which has way to much security for running apps in the background and closes apps without user input or notification and I had to disable Google Play Protect to get my apps to run as long as I wanted. According to Google Android 11 is going to be more restrictive. Also, in the design screen on the player I enabled loop, now, my app plays continuously without stopping.
As I’ve said - often enough - there is no other option than to use a Foreground service so that the audio doesn’t stop on any device while streaming.
If no Foreground service is used, the sound will definitely stop e.g. on a
- Galaxy Note8 (Android 9) and
- S8 (Android 9).
Yes, I stand corrected. It did stop and restarted itself, but to many times, not good. TY