Code samples
The following code samples show you how to use the Push Service APIs of the BlackBerry 10 Native SDK to do the following:
- Create a PushService object to create a push session and perform push-related operations.
- Check the PushService object connection to the 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.
- Create a push session to establish communication with the PNS agent.
- 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 our 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.
Last modified: 2013-06-12