iOS Question Firebase data only notification no longer arrive

MarkNZ

Member
Licensed User
Longtime User
I have an IOS and Android app to which I send 'data packet only' notifications - that don't display or trigger a notification sound on the devices.

Having updated B4I and updated the firebase framework to the recently updated version for the wrappers, the IOS App has stopped recognizing these notifications.

The published App continues to work as expected.

A notification with an iosnotification component attached (title body etc) is recognized and displayed.

But the data only ones no longer show up in the App.

If I load the backup of the code for the published version it doesn't work anymore while the pearlier compiled and published copy does.

The implication is that the messages are arriving on the device (as the old copy works) but not being picked up by the app anymore.

Anyone have anything to offer?

The notification is used to tell the app to refresh its data - if it is running. Not necessary if it is closed.
 

MarkNZ

Member
Licensed User
Longtime User
Thanks for you r quick response

We don't use the B4J tool, the messages are generated on a couple of ASP.NET driven website using the FirebaseNet library.

From the library summary in GITHUB :
"
Firebasenet. Client library for Firebase Cloud Messaging

Message Types

With FCM, you can send two types of messages to clients:

Notification messages, sometimes thought of as "display messages."
Data messages, which are handled by the client app.

A notification message is the more lightweight option, with a 2KB limit and a predefined set of user-visible keys. Data messages let developers send up to 4KB of custom key-value pairs. Notification messages can contain an optional data payload.
"


Data messages don't trigger a notification in the notification tray or an arrival sound, just a reaction within the app itself if it is open.

If the App is open the message is received through the
'Application_RemoteNotification (Message As Map, CompletionHandler As CompletionHandler)'
event in the IOS App.

Now in the IOS app the event is no longer being triggered when a data only message arrives on the device.
It still triggers for notification type messages.
The Android app still works as designed in all respects.

If the currently released IOS version of the App is installed on the device, the messages arrive in the App as per normal, so the messages are still arriving on the devices ok.

If we change the data message to a notification message by adding a Title or Body content to the message, it arrives but of course triggers the phones new notification routine and lists it on the notification tray which is not what we want. If the App is open we want it to react otherwise the message can be ignored.


The problem seems to have started after upgrading to the current version of B4I, and also updating the firebase libraries from this post
https://www.b4x.com/android/forum/threads/firebase-facebook-v2-0-july-2019.107435/#content
to resolve a new compile error we got "framework not found Protobuf".

Perhaps the updated firebase wrapper is ignoring incoming messages that don't have Notification content?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. "Data messages" is a firebase term, it is not really an iOS feature and it is more relevant to Android.
2. Push messages will not show anything if the app is in the foreground. They will only raise the RemoteNotification event.
3. If you don't want the notification to show when the app is not running (not in the foreground) then use: Silent Push Notifications
Do note that they are less reliable.

4. In all cases, start with sending the messages with the B4J tool. Once you get everything working you can switch to other ways.
 
Upvote 0

MarkNZ

Member
Licensed User
Longtime User
We considered background notifications but it has less than ideal behavior as in triggering the app in the background if it is closed. There may well at times be many notifications going on that are only relevant if the app is open. Not having the app trigger when closed is better behavior overall while we can achieve that.

So we will drop back to B4I 5.8 and use the earlier Firebase wrappers that pass on the notifications for now, until something forces us to abandon 5.8.


Just for your information.

The messages are passed to Firebase "agnostic-ally" with a list of devices and it processes them from there to both android and apple devices so I guess at the moment Firebase expect the messages to be successfully delivered to apple devices, which they are of course.


The non displaying notifications are arriving in the IOS App (with a data component of action) looking like this :

(read only map) {
action = refreshdata;
"collapse_key" = UpdateData;
from = 699680787079;
}

and the display notifications look something like (which include the so called Data component here being action, message and msgtitle).

(read only map) {
action = ShowMessage;
aps = "(read only map) {\n alert = \"(read only map) {\\n body = adsadad;\\n title = asasdasd;\\n}\";\n sound = default;\n}";
duration = 5;
"gcm.message_id" = 1572998060182049;
"google.c.a.e" = 1;
message = adsadad;
msgtitle = asasdasd;
}

The key difference seems to be the missing aps section which I guess is why they don't trigger a notification tray reaction on the device when the app is closed but still get picked up by the app when open.

Anyway thanks for your help.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4i version has nothing to do with this behavior. You can revert to an older version of Firebase SDK + Firebase libraries.
There is no such thing as "background notifications". I guess that you mean silent push notifications.

Silent push notifications will not make your app visible if it is not running. It will start the process and you can immediately end it.
 
Upvote 0
Top