Android: startForegroundService() not allowed due to mAllowStartForeground false
See original GitHub issueEverything works fine when the app activity is running (in foreground or background).
But when the app is killed, the app starts in headless mode and then fires the notification as a Foreground Service. In this scenario, the notification does not show and notifee throws this error:
Error: startForegroundService() not allowed due to mAllowStartForeground false: service app.notifee.core.ForegroundService
at Object.promiseMethodWrapper [as displayNotification] (NativeModules.js:106:51)
at NotifeeApiModule._this.displayNotification (NotifeeApiModule.js:265:32)
If I set asForegroundService
to false, the notification will show but without any styling.
I am on latest notifee version 5.4.1.
This is definitely related to Android 12 and the new Foreground Service restrictions imposed on apps, but according to this, my case should be exempt from these restrictions, since my app meets this exception Your app receives a high priority message using FCM.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Exception: startForegroundService() not allowed due to ...
When the application is closed or when the application went to the background, invoking Service using startForegroundService will cause ...
Read more >SDK31 Android12 can't executing services on background ...
Fatal Android 12: Exception: startForegroundService() not allowed due to mAllowStartForeground false. I noticed one exception (Firebase ...
Read more >Foreground services - Android Developers
startForegroundService() to start a foreground service that another app owns ... If the message's priority is downgraded, your app is not allowed to...
Read more >Solved - appsloveworld
[Solved]-Caused by android.app.ForegroundServiceStartNotAllowedException startForegroundService() not allowed due to mAllowStartForeground false-kotlin.
Read more >r/androiddev - Reddit
startForeground() not allowed due to mAllowStartForeground false: ... setServiceForeground(IActivityManager.java:7194) at android.app.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any java code imported in the app’s symbol space is available as an API, you can just call things I think
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
Thank you for your contributions.