01-23-2012 04:25 AM
Hi everybody,
I use code as the following to register my application (BIS + service type Essentials). I always receive the status STATUS_PENDING (status value after using PushApplicationRegistry.registerApplication is 2) after registering my application, even though I wait for some minutes. Could someone know why? If so, could you help me solve my issue?
int port = // value received by form registration;
String appId = // value received by form registration;
String bpasUrl ="http://pushapi.eval.blackberry.com";
byte serverType = PushApplicationDescriptor.SERVER_TYPE_BPAS;
ApplicationDescriptor ad = ApplicationDescriptor.currentApplicationDescriptor
PushApplicationDescriptor pad = new PushApplicationDescriptor(appId, port, bpasUrl, serverType, ad);
// check whether already registered or registration pending
PushApplicationStatus pushApplicationStatus = PushApplicationRegistry.getStatus(pad);
byte pasStatus = pushApplicationStatus.getStatus();
if (pasStatus == PushApplicationStatus.STATUS_ACTIVE) {
//Dialog.alert("register STATUS_ACTIVE.");
// we already registered, update the statuses
Logger.log("Already registered with BPAS");
return;
} else if (pasStatus == PushApplicationStatus.STATUS_PENDING) {
//Dialog.alert("register STATUS_PENDING.");
// we already scheduled registration, wait for its result
Logger.log("Registration with BPAS already scheduled");
} else if (pasStatus == PushApplicationStatus.STATUS_NOT_REGISTERED) {
//Dialog.alert("register STATUS_NOT_REGISTERED.");
// not registered yet, register
Logger.log("Scheduled registration with BPAS");
PushApplicationRegistry.registerApplication(pad);
PushApplicationStatus pushApplicationStatus1 = PushApplicationRegistry.getStatus(pad);
Logger.log("active: " + (pushApplicationStatus1.getStatus() == PushApplicationStatus.STATUS_ACTIVE) );
Logger.log("status value: " + pushApplicationStatus1.getStatus());
} else if (pasStatus == PushApplicationStatus.STATUS_FAILED) {
//Dialog.alert("register STATUS_FAILED.");
// failed registration, retry
Logger.log("Registration failed with BPAS, try again");
PushApplicationRegistry.registerApplication(pad);
}
Thanks in advance,
Kinh
01-23-2012 09:50 AM
Hi,
Finally I knew what happened for my case. In fact, I have to use the Internet service 3G instead of wifi to register my application. Thank you anyway.
Kinh