iOS Question How to identify that a Push Message arrives

Luiz Fernando Orlandini

Active Member
Licensed User
Hi there,

I could't figure out how to implement a Sub that can identify when a push message arrives.

Looking Apple documentation, I discovered that we can catch that event in application:didReceiveRemoteNotification:fetchCompletionHandler.

How can I implement this event in B4i?
Last edited:

Luiz Fernando Orlandini

Active Member
Licensed User
Have you seen B4i tutorial:

It is clearly explained there.
Sorry Erel, but I need to identify that message arrives at device when Application is in background!

The Application_RemoteNotification event will be raised when a message arrives while the app is in the foreground. If the app is not in the foreground then a standard alert message will appear. The user can click on the message to the start the app.
The Application_RemoteNotification event will be fired after the app is started.
However for this to work in all cases you need to add the following sub and call it from Application_Start:

So... How can I identify that a new push notification just arrived in the device, without starts the application.

My scenario is: I received a new message, and I need to inform my servers that this message was delivered to user. When user opens the notification, I will update the message status to readed.

Any thoughts?
Upvote 0


B4X founder
Staff member
Licensed User
Your app is not started when a message arrives. So you can't do anything at that point. Only when the user presses on the notification your app will start.

However as it is you who are sending the message to the user you can track this information. You should treat push messages as a way to tell the user that there is new information available. Only when the user goes to your app and "reads" the message in your app you should mark it as read.
Upvote 0