Code samples

The code samples show you how the sample application uses the Push Service APIs of the BlackBerry 10 SDK for Adobe AIR to perform the following actions:

  • Create a PushService object in order to create a push session and perform push-related operations.
  • Create a push session to establish communication with the Push Notification Service (PNS) agent running on the device. 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 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.
  • Handle a connection error with the PNS agent.