Skip Navigation

METHOD_ScheduleNotification

This method enables a 
BlackBerry Connect
 client session to schedule a silent notification that is sent to a client at a scheduled time to process when the client is in the background. This notification allows the client to respond when it receives a remote notification (for example, a wakeup call to maintain session keepalive or a notification prior to the Windows access token expiration). This method is not supported for GNP notifications.
The following table describes the parameters that you can include in this method.
Parameter
 
Type
Required
Description
scheduleAt
Integer
This parameter specifies the server relative time when the ScheduleNotification is sent to the client (for example, UTC ms since 1970/01/01).  
tag
String
This parameter is a client specified value that indicates the type of notification. The client can schedule multiple notifications, but each notification must have unique tags. Use descriptive names for the tags. For example,
  • Use windows_access_token_refresh when scheduling a notification to refresh a token. 
  • Use session_keepalive when scheduling a notification to ping BEMS to keep the session alive.  
clientData
json dictionary object
This optional parameter is a json dictionary object, that when it is available, is included in the notification payload request to 
BEMS
.
For 
Android
 devices, the FCM format allows string values within the data. The client string encodes the clientData when it sends the request to 
BEMS
.

Code sample

The following example sends a request to 
BEMS
 to schedule a notification that is sent to the 
BlackBerry Connect
 app at a specified time.
{ "id":"c3" "method":"ScheduleNotification", "params": { "scheduleAt":"1551522681", "tag":"session_keepalive", "clientData": { "task1":"wake up", "task2":"keep session alive" } }, "jsonrpc":"2.0" }
If there are no errors, 
BEMS
 sends the following confirmation to the 
BlackBerry Connect
 app to schedule the notification.
{ "id":"c3", "error":"null", "result": { "data": { "method":"ScheduleNotification", "state":"COMPLETE" } }, "jsonrpc":"2.0" }
At the scheduled time, 
BEMS
 sends a silent notification to the 
BlackBerry Connect
 app as requested.
  • On an 
    iOS
     device,
    { "aps": { content-available = 1 } "custom": { "ts":"1551522681", "tag":"session_keepalive", "clientData" { "task1":"wake up", "task2":"keep session alive" } }, "jsonrpc":"2.0" }
  • On an 
    Android
     device,
    "data": { "params": { "scheduleAt":"1551522681", "tag":"session_keepalive", "clientData": { "task1":"wake up", "task2":"keep session alive" } }, "jsonrpc":"2.0" }