You should have received a mail with your credentials for both server app and blackberry client app. For the client app, they should look like this:
Application ID: <CPID(4 chars)>-<id(35 chars)>
PPG Base URL: http://cpXXX.pushapi.eval.blackberry.com
Push Port: <port(5 chars)>
As you can see, the App id has two parts. The prefix before the dash is your CPID, and the rest is the id. Then we have an URL where we will need to replace the XXX with the CPID (note that the CPID usually is a 4 digit number, so it would have been better if they had used XXXX as placeholder). Finally the port number which has up to 5 digits.
With those params, in your BB app, you would code something like this:
String id = "<your full app id here>";
String url = "http://cp<CPID>.pushapi.eval.blackberry.com"; //Make sure it is http and not https, and check you have replaced <CPID> with the appid prefix.
int port = <port>;
byte serverType = <PushApplicationDescriptor.SERVER_TYPE_BPAS or
PushApplicationDescriptor.SERVER_TYPE_NONE>;
ApplicationDescriptor descriptor = ApplicationDescriptor.currentApplicationDescriptor();
PushApplicationDescriptor pushDescriptor = new PushApplicationDescriptor(id, port, url, serverType, descriptor);
// This is how we would register the client app:
PushApplicationRegistry.registerApplication(pushDescriptor);
After executing that line, if everything is ok (registration needs some time, a few connections are made), you can check the registration status calling PushApplicationRegistry.getStatus
or via the onStatusChange
callback.