Skip to content

Latest commit

 

History

History
107 lines (74 loc) · 8.02 KB

README.md

File metadata and controls

107 lines (74 loc) · 8.02 KB

Push Capture Sample Application

The Push Capture sample app (post coming soon!) demonstrates how to write a BlackBerry 10 WebWorks application that is able to receive pushes.

Consult the PushService and PushPayload classes from the API reference for useful examples and a full description of how to use the push APIs. The API reference can be found here. Look under the Push heading from the menu on the left side.

The sample code for this application is Open Source under the Apache 2.0 License.

Applies To

Author(s)

Dependencies

To contribute code to this repository you must be signed up as an official contributor.

How to Build

To build the Push Capture sample application:

  1. Click on the Downloads tab above.
  2. Select Download as zip (Windows) or Download as tar.gz (Mac) and save the downloaded file to your local machine.
  3. Create a new folder on your local machine named pushCapture e.g. C:\Documents and Settings\User\WebWorks\pushCapture (Windows) or ~/WebWorks/pushCapture (Mac).
  4. Open the downloaded ZIP file from step 2 and extract the contents from inside the zipped pushCapture folder to your local pushCapture folder from step 3. This ensures that the necessary application assets, such as config.xml, are correctly located at the top level of the local pushCapture folder (e.g. ~/WebWorks/pushCapture/config.xml).
  5. When you're ready to try out the Push Capture sample app on your BlackBerry 10 device (the simulator and Ripple are not yet supported), make sure you first download the BlackBerry 10 WebWorks SDK.
  6. Create a ZIP file from your local pushCapture folder with config.xml and the HTML files at the root level of your ZIP (the root level should not be a folder). See Creating a WebWorks archive file for more details.
  7. Follow the instructions from Package your BlackBerry 10 app with the BlackBerry 10 WebWorks SDK to get the app running on your BlackBerry 10 device.

How to send a push

In order to be able to send pushes to the Push Capture sample app, you will need to write a server-side push application (called a Push Initiator) to send out pushes with. Luckily, this is fairly easy to do using the Push Service SDK available here.

You'll find all the documentation for the Push Service SDK here.

Note that in order to use the Push Service for developing an application for the general public, you will have to first register here.

How to receive a push

  1. Start the Push Capture sample application (if you haven't done so already).
  2. An alert will pop up telling you that you need to configure the sample application. You will be taken to the configuration screen.
  3. Click Public/BIS if the PPG is the BlackBerry Internet Service or Enterprise/BES if the PPG is the BlackBerry Enterprise Server.
  4. Clear the Use Push Service SDK as Push Initiator check box if one of the following is true: i) You implemented a Push Initiator that does not use the Push Service SDK. ii) Your Push Initiator only uses the low-level APIs without subscription support from the Push Service SDK.
  5. If the Use Push Service SDK as Push Initiator check box is selected, in the Application ID field, perform one of the following actions: i) If you are using the BlackBerry Internet Service as the PPG, type the application ID specified in the confirmation email message that you received from RIM. ii) If you are using the BlackBerry Enterprise Server as the PPG, type a unique application ID of your choosing. If you clear the Use Push Service SDK as Push Initiator check box, you cannot type an application ID. In this case, the Push Service APIs create an application ID for you automatically.
  6. If you are using the BlackBerry Internet Service as the PPG, in the PPG URL field, type the PPG base URL specified in the confirmation email message. The sample application uses this URL to create a channel to the PPG. For an evaluation environment, the URL is http://cp{cpid}.pushapi.eval.blackberry.com, where {cpid} is your content provider ID. For a production environment, the URL is http://cp{cpid}.pushapi.na.blackberry.com.
  7. If the Use Push Service SDK as Push Initiator check box is selected, in the Push Initiator URL field, type https://{server_address}/pushsdk, where {server_address} is the address of the server where the pushsdk helper application is deployed. The SDK includes the pushsdk helper application that is deployed on a server, such as the Apache Tomcat server. The URL must be accessible from the Internet. Of course, you can also point to your own running Push Initiator application instead of the provided pushsdk helper one.
  8. Click the Launch App on New Push check box if you want to start the sample application if it is not already started when a new push message arrives. Leave the check box unchecked if you do not want to start the sample application when a new push message arrives.
  9. Click Save.
  10. Tap the Register tab at the bottom of the device screen. The register screen will appear.
  11. If you had previously checked the Use Push Service SDK as Push Initiator check box, you will be required to enter a username and password. These will be mapped, after authentication, to a subscriber ID in your Push Initiator. If the Use Push Service SDK as Push Initiator check box had not been checked, then simply click Submit.
  12. You're all set to receive pushes!

More Info

Contributing Changes

Please see the README of the WebWorks-Samples repository for instructions on how to add new Samples or make modifications to existing Samples.

Bug Reporting and Feature Requests

If you find a bug in a Sample, or have an enhancement request, simply file an Issue for the Sample.

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.