Reputation: 4283
On my Huawei P20 Lite (Android 9), there is a setting Power usage details -> app launch -> "Manage automatically". With this setting enabled, I noticed that the OS sometimes kills my app when it is in background.
The app acts as a streaming server.
Is it possible to programmatically disable "Manage automatically" and enable the "Run in background" settings ?
EDIT: I noticed that famous app such as Deezer or Spotify don't request ignoring battery optimization and they are never killed when playing music in background. Does anyone know how they achieve that ?
Upvotes: 3
Views: 5109
Reputation: 1689
Implement Foreground Service
in your app to increase the component priority in OS to lower the odds of its killing.
Upvotes: 1