Code samples

The code samples show you how the sample application uses the Push Service APIs of the BlackBerry 10 WebWorks SDK to do the following:

  • Create a PushService object to use the object to perform push-related operations.
  • Start running the application in the background if it isn't already running when a push message arrives.
  • Create a push channel to the PPG and subscribe with the Push Initiator. The Push Initiator uses the push channel to send push notifications to the sample application.
  • Receive a push message.
  • Acknowledge the receipt of a push message.
  • Exit the application after processing a push message.
  • Handle notifications in the BlackBerry Hub.
  • Destroy a push channel and unsubscribe from the Push Initiator.
  • Automatically detect a changed SIM card and stop receiving push messages on the device.
  • Handle a push transport error and a PPG server error.