Android Question Error in Crashlytics: Firebase Notifications (Android 12/13)

asales

Expert
Licensed User
Longtime User
I get this error in the Firebase Crashlytics console:
B4X:
Fatal Exception: java.lang.RuntimeException: Unable to start receiver br.com.myprofile.firebasemessaging$firebasemessaging_BR: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service br.com.myprofile/.firebasemessaging
It happens only in Android 12 and 13.

I use B4A 12, FirebaseNotifications lib 3.00, B4J to send the messages and this code from Erel.

What could be happen?
How can I fix this?

Thanks in advance for any tips.
 

Alex_197

Well-Known Member
Licensed User
Longtime User
I get this error in the Firebase Crashlytics console:
B4X:
Fatal Exception: java.lang.RuntimeException: Unable to start receiver br.com.myprofile.firebasemessaging$firebasemessaging_BR: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service br.com.myprofile/.firebasemessaging
It happens only in Android 12 and 13.

I use B4A 12, FirebaseNotifications lib 3.00, B4J to send the messages and this code from Erel.

What could be happen?
How can I fix this?

Thanks in advance for any tips.
I have this problem myself - exactly as in your case.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
High priority messages are allowed to start services while in the background. Either you are sending some messages without the high priority flag or the devices are misbehaving.

Services are becoming more and more problematic. I'm working on a solution that will allow to run some code in the background without services, but it will take some time to be ready.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
High priority messages are allowed to start services while in the background. Either you are sending some messages without the high priority flag or the devices are misbehaving.

Services are becoming more and more problematic. I'm working on a solution that will allow to run some code in the background without services, but it will take some time to be ready.
Will be great. I send the notification as high priority, but even in this way I get the error in crashlytics.
 
Upvote 0
Top