MobileNotifications.Send
From Xojo Documentation
New in 2020r2
Supported for all project types and targets.
Send the notification to the OS for immediate delivery.
New in 2020r2
Supported for all project types and targets.
Sends the notification to the OS for delivery once the interval has been reached.
New in 2020r2
Supported for all project types and targets.
Sends the notification to the OS for delivery in secondsFromNow seconds.
New in 2020r2
Supported for all project types and targets.
Sends the notification to the OS for delivery at the date and time specified by the scheduleDate.
New in 2020r2
Supported for all project types and targets.
Sends the notification to the OS for delivery when the device enters or exists a region as specified by radius meters around a specific latitude and longitude.
Notes
In cases where the notification won't be immediately displayed, Send returns a UUID which your app should store if you wish to be able to remove the notification before it is displayed.
Repeating Notifications
There are times when you may wish a notification to repeat. To do this, set the shouldRepeat parameter to True. The interval at which it repeats is based upon the method signature you used. For example, if you want the notification to repeat hourly, set the interval to 1 hour. To repeat every year on the same day, set the DateTime and to repeat every time the user enters or exits a region, set the latitude, longitude and radius.
Creating a repeating notification is no guarantee the notification will in fact repeat. If the user has turned off notifications for your app, if their device is in Do Not Disturb mode or Low Power mode, notifications may not be delivered.
Sample Code
Send a notification right now:
Send a notification every hour:
Var interval As New DateInterval(0, 0, 0, 1)
id = NotificationCenter.Send(interval, New NotificationContent("Are we there yet?"), True)
Send a notification in 30 seconds:
id = NotificationCenter.Send(30, New NotificationContent("Your access code has expired."))
Send a notification on a specific date every year:
Var birthday As DateTime(2890, 9, 22)
id = NotificationCenter.Send(birthday, New NotificationContent("Happy Birthday, Bilbo!"), True)
Send a notification to remind the user to visit the President of the United States when they are in town:
id = NotificationCenter.Send(38.897957, -77.036560, 1000, New NotificationContent("Visit the POTUS."), True)
See Also
NotificationContent, DateInterval and DateTime classes.