[Firebase Mobile] FirebaseCloudMessaging web block not triggered if app is in background?

Forge Component
(22)
Published on 26 May by Patrícia Glória Ferreira
22 votes
Published on 26 May by Patrícia Glória Ferreira

I am successfully receiving push notifications on both iOS and Android, whether the app is in the foreground or the background - great!

But the web block FirebaseCloudMessaging, which I added to my Layout block per the suggested configuration, only gets triggered when the app is in the foreground.  If the app is in the background, this web block and it's event handler don't seem to get called.  I verified this by running the OutSystems debugger with the Android version of my app.

There is an attribute "AppInBackground" in the "NotificationData" structure that implies to me that it should be able to work this way.

Does anyone know if this should be working, and what I might be doing wrong?  We seem to have version 1.8 of the component in our environment.  We are OutSystems 11.something.  

Thanks.

So after further experiments, here is what I observed:


1. On Android, the web block FirebaseCloudMessaging does indeed get triggered if your app is in the background.  It seems to work as I expected.

2. On iOS, the block FirebaseCloudMessaging does not get triggered if your app is in the background, at the time your notification is sent.  When the user brings the app to the foreground, then the web block is triggered, and any associated code runs at that time.

3. On both platforms, and in all circumstances, the attribute "AppInBackground" in the "NotificationData" structure is False.  So, not very helpful.

This is unfortunate, as I was hoping to use this web block to allow my app to update its badge number based on the number of notifications it has received since the last time the user refreshed.

I am not saying that this is the definitive explanation of how this is supposed to work.  I am just documenting what I have observed.