Code samples

The code samples are from our headless and UI sample applications. They show you how to use the Push Service APIs of the BlackBerry 10 Native SDK to do the following:

  • Create a PushService object so that your application can create a push session and perform push-related operations. The push session is required to establish communication with the PNS agent. The PNS agent is a software component that maintains a connection with the PPG, and forwards push notifications that it receives from the PPG to the appropriate application instance.
  • Start running your headless 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 our sample application.
  • Receive a push message.
  • Acknowledge the receipt of 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.
  • Handle a lost connection with the PNS agent.

Last modified: 2013-12-21

comments powered by Disqus