Configure the sample application

When you run the sample application for the first time, you need to specify whether the PPG is the BlackBerry Internet Service or the BlackBerry Device Service. If you're using the BlackBerry Internet Service as the PPG, you also need to provide the information from the confirmation email message that you received when you signed up with BlackBerry to use the Push Service. When you develop your application, you can code this information into your application instead of displaying it in a configuration screen and requiring the user to type the information.
Before you begin: You need to build and deploy the sample application to a BlackBerry device before you configure it. For information about building and deploying the application, see Download and build the sample application.
  1. Start the sample application in one of the following ways:
    • Load the packaged PushReceiver.bar file onto your BlackBerry device and start it.
    • Run the PushReceiver project in Adobe Flash Builder using the Run As/Debug As > Mobile Application options.
  2. Tap Config at the bottom of the device screen.
    The configuration dialog box appears.

    Screen showing configuration options for the sample application.

  3. Tap Public/BIS if the PPG is the BlackBerry Internet Service or Enterprise/BDS if the PPG is the BlackBerry Device Service.
  4. Clear the Subscribe with Push Service SDK check box if one of the following is true:
    • You implemented a Push Initiator that does not use the Push Service SDK.
    • Your Push Initiator only uses the low-level APIs without subscription support from the Push Service SDK.
    • You’re using the low-level sample Push Initiator that comes with the Push Service SDK.
  5. If the Subscribe with Push Service SDK check box is selected, in the Application ID field, perform one of the following actions:
    • If you use the BlackBerry Internet Service as the PPG, type the application ID specified in the confirmation email message that you received from BlackBerry.
    • If you use the BlackBerry Device Service as the PPG, type a unique application ID of your choosing. If you clear the Subscribe with Push Service SDK check box, you cannot type an application ID. In this case, the Push Service APIs create an application ID for you automatically.
    The sample application uses the application ID when it creates the PushService object to perform push-related operations. To specify the application ID in your application, you use the providerApplicationID parameter of the PushService() constructor.
  6. If you use 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 Subscribe with Push Service SDK check box is selected, in the Push Initiator URL field, type https://<server_address>/high-level-sample, where <server_address> is the address of the server where the high-level sample Push Initiator is deployed. The Push Service SDK includes the high-level sample Push Initiator that is deployed on the Apache Tomcat server. The URL must be accessible from the Internet.
    Depending on how you implemented your Push Initiator, you might want to use your own Push Initiator that handles subscriptions instead of using one of our sample Push Initiators.
  8. Tap the Launch Application on New Push check box if you want to start the sample application if it isn't already running when a new push message arrives. Leave the check box unchecked if you don't want to start the sample application when a new push message arrives. If the check box is unchecked, and the application isn't running, it won't receive the push message.
  9. Tap Save.
    The sample application stores the configuration in the database, and calls createSession() to create a push session. If the createSession() call is successful, the application calls registerToLaunch() or unregisterFromLaunch() depending on the selection you made for the Launch Application on New Push option in the configuration dialog box. For details about these calls, see Creating a PushService object and a push session and Start running the sample application in the background when a push message arrives.