MobileNotifications.NotificationReceived

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Event


MobileNotifications.NotificationReceived(notification as Notification) As PresentationModes

New in 2020r2

Supported for all project types and targets.

A local Notification has been received while your app was in the foreground.

Notes

In this event, you should handle the Notification and then return a value that indicates how you would like the notification to be presented to the user. Whether or not the notification will be displayed as requested will depend on the user's notifications settings for your app.

Handing Different Types of Notifications

While this event receives a generic Notification object, you can use the IsA operator to determine what type of Notification it received and then typecast the object to access the type-specific properties.

If notification IsA CalendarNotification Then
Var FirstDisplayed As DateTime = CalendarNotification(notification).FirstTriggerDate
If FirstDisplayed < DateTime.Now Then
MessageBox("Don't make me say this again.")
End if
End If

The notification can be a CalendarNotification, a TimeIntervalNotification, RemoteNotification or a LocationNotification class object.

See Also

Notification class, MobileNotifications.PresentationModes enumeration.