Android Question Firebase messaging is crashing (API >= 26 (Oreo))


Active Member
Licensed User
Longtime User
I am updating my apps to the latest android OS and am having difficulty with implementing Firebase messaging using the latest Android API. I have searched the forum and had not found anything discussing this issue. I may have missed a previous discussion. Sorry if this has already been discussed.

The issue is that the Firebase messaging service will crash if the app is not foreground or isn't in the "recent" list. The Firebase messaging works fine running under pre-Oreo even when the app is not foreground and not in the "recent" list.

I believe that it may be related to the recent os changes described here:

Crash report:
Exception java.lang.IllegalStateException: Not allowed to start service Intent { act=b4a_firebasemessaging cmp=com.scsoftstudios.edacec/.firebasemessaging (has extras) }: app is in background uid UidRecord{d6ef069 u0a304 RCVR idle change:uncached procs:1 seq(0,0,0)} ( (
android.content.ContextWrapper.startService (
anywheresoftware.b4a.objects.FirebaseNotificationsService.onMessageReceived ( () ()
java.util.concurrent.ThreadPoolExecutor.runWorker (
java.util.concurrent.ThreadPoolExecutor$ ( (

Has anybody discovered a workaround for this issue where Firebase messaging works properly with Oreo devices whether the app is not in the foreground nor in the "recent" list?

Thank you for your help.



Active Member
Licensed User
Longtime User
Don't set targetSdkVersion to 26 for now. See the background limitation note:

It will be addressed in the next update of B4A.
Thank you @Erel. I downgraded my apps to SDK 25 and Firebase messaging is working properly now on all my test bench devices including devices currently running OS 8.1 (SDK 27). I have updated all my apps to include many of the requirements such as "runtime permissions" and "File Provider" and they are working well when I target the apps to SDK 27. Regardless, those upgrades also work with SDK 25.
My only issue at the present time are services such as Firebase Messaging. I'm looking forward to future B4A updates that will address these issues. I'm planning to publish in the fall of this year so I hope that this is resolved. Thank you again.
Last edited:
Upvote 0