I have a question.
Android 8.0 introduces a new Context.startForegroundService () method that creates a new service in the foreground.
But I update target version to Android 12 , App is crushed. Error is ForegroundServiceStartNotAllowedException.
I'm implementing app like spotify or apple music.
Shouldn't startForegroundService() be used in applications with the target version set to Android 12? And Should I use only startForeground() ?
Thank you.
CodePudding user response:
The Behavior Changes Again.
https://developer.android.com/guide/components/foreground-services
You should start the service when the app is in front.