0

Recently I have discovered that about 2 months ago there was released Android 11 update for Samsung devices.

Samsung has in this version of OS decided to really strictly suspend the apps/services running in the background (more info)

So e.g. when app I am working on goes to background and phone is locked, all BT communication is almost immediately suspended. When I unlock the screen, in that exact moment all threads are not suspended anymore and execution continues.

OS therefore completely ignores the foreground service mechanism. Official documentation

Also when I try to add my app to the list of "Never sleeping apps" (some alternative to battery optimization whitelist on Android 11) - app is still getting suspended + this whitelisting mechanism appears to be unstable and even when I add my app to the whitelist, app disappears from the list after few hours.

My questions:

  • Have you seen similar issues on Android 11 too ? What helped to resolve the issue?

  • Is this only Samsung specific issue or even Pixel devices do the same optimization (ignoring foreground service and whitelist)?

Thanks for any input.

stuckoverflow
  • 625
  • 2
  • 7
  • 23

1 Answers1

0

sadly this is a huge and common problem and my repsonse will probably not fix it for you, but give you some more insights and possible work-arounds. Have a look at dontkillmyapp.com.

Especially dontkillmyapp.com/samsung:

On Android 11 Samsung will prevent apps work in background by default unless you exclude apps from battery optimizations. This is a severe divergence from standard Android process management policies. Yes, this is a long way to go! Devs cannot ask for it automatically as they risk being kicked out from Play Store due to policy violations.

Also I can highly recommend very insightful the fun talk fron Droidcon Berlin 2021.

Tobias
  • 7,282
  • 6
  • 63
  • 85