XojoCloud.RemoteNotifications
From Xojo Documentation
![]() |
This module is only available for Web applications. |
Allows the sending of remote notifications to iOS devices via a Xojo web application running on Xojo Cloud.
Methods | |
|
Delegate Methods | |
|
Notes
The information needed for sending a remote notification comes in three categories:
- The device token (String) – This is a unique hex-encoded identifier, provided by the device itself, which represents a message destination.
- Delivery Options (Class) – Specifics about how and where the message(s) are being delivered. See XojoCloud.RemoteNotifications.DeliveryOptions for the details.
- Message (Class) – The contents of the message being delivered. See XojoCloud.RemoteNotifications.Message for the details.
The actual message being sent can be in one of two forms:
- A XojoCloud.RemoteNotifications.Message which is format most Xojo apps sending remote notifications will use or in JSONItem format which allows for more elaborate messages than Xojo currently supports. The latter is primarily for apps not written in Xojo that use Xojo Cloud for remote notifications.
If an error occurs, the delegate method will be called and passed the UUID and a RuntimeException containing the error information of the notification in which the error occurred.
Sample Code
This example sends a remote notification message to all of the devices whose device tokens exist in the customerTokens array. Note that the values assigned to APNSKeyID and AppleTeamID would come from your Apple developer account:
Const ApplicationID as String = "com.example.myapp"
Const APNSKeyID as String = "ABS123"
Const AppleTeamID as String = "MY123COMP456ANY"
// First we define the delivery options for this group of notifications
Var deliveryOpts as new XojoCloud.RemoteNotifications.DeliveryOptions(ApplicationID, APNSKeyID, AppleTeamID)
// Create a message that we want to send to our customers
Var message as New XojoCloud.RemoteNotifications.Message
message.alertTitle = "Bobby's Barbecues"
message.alertSubtitle = "Memorial Day Weekend Sale!"
message.alertBody = "Hurry on in! Our Memorial Day sale is going on right now and all grilling equipment is 40% off!"
For i as Integer = 0 to customerTokens.LastIndex
XojoCloud.RemoteNotifications.SendAppleNotification(message, deliveryOpts, customerTokens(i))
Next i
See Also
XojoCloud.RemoteNotifications.DeliveryOptions and XojoCloud.RemoteNotifications.Message classes.