Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ForegroundServiceStartNotAllowedException

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

>Solution :

The Behavior Changes Again.

https://developer.android.com/guide/components/foreground-services

You should start the service when the app is in front.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading