Name: pushNotificationReceived

Type: message

Syntax: pushNotificationReceived <message> 

Summary: Sent when the application receives a push notification from a Push Notification Server.

Associations: stack

Introduced: 5.5

OS: ios,android

Platforms: mobile

Example:
on pushNotificationReceived tMessage
   answer "Push Notification:" && quote & tMessage & quote with "Okay"
end pushNotificationReceived

Parameters:
message: The Notification Message received. This is text that was submitted when the message was scheduled with the Push Notification Server.

Description:
Handles the <pushNotificationReceived> message to perform an action when the device receives a push notification message from a server for the application.

The <pushNotificationReceived> message is handled once the application receives a push notification from a Push Notification Server.

Depending on the status of the application, iOS can launch a dialog box or open the login screen to inform the user that an application has information for them. Android can create an application icon in the status bar. The user can then decide whether or not to open the application. If the application is opened as a result of the notification, then LiveCode can handle the message. If an application is currently running when it receives a notification, then LiveCode can handle the message and process it as required.

If a badge number is received with the notification, then that badge value is displayed on the applications icon (iOS only), but only if the application is not currently running. If the application is running, then a badge value update does not take place, as the application can handle the message without being launched.

References: iphoneSetNotificationBadgeValue (command), iphoneGetNotificationBadgeValue (function), pushNotificationRegistered (message), pushNotificationRegistrationError (message)
