I have a few questions about certain behavior on Android devices. I'm using SDK which ask the user to turn-off battery optimization for the app. I'm also running a foreground service which implements some interfaces from said SDK. I need the foreground service to run as long as possible with out any other interaction with the app.
What I wanted to know is:
If the user allows to turn off the battery optimization - does it mean that the OS can't kill my foreground service (or it will be killed under some strict conditions).
If the user doesn't allow to turn off the battery optimization - does it mean that the OS will kill my service more easily?
If under some conditions the OS kills my service, the foreground service is also dead, will the service come back to life if I made it
START_STICKY
and if so, how long does it take it to restart?