Я пытаюсь зарегистрироваться в push-уведомлениях BlackBerry, но отображается исключение тайм-аута.
Вот код, который я написал
HttpConnection httpConn = (HttpConnection)Connector.open(url+;interface=wifi,Connector.READ, false);
/**
* Attempts to register this device with the BlackBerry Push server. This
* method also alerts the user whether the registration was successful
* or not.
*
* @return True if the registration was successful, false otherwise.
*/
public boolean registerForService()
{
if( !isRadioConnected() )
{
return false;
}
try
{
// Open a connection with the BB Push server and request registration
byte[] encryptedData = connectAndRead(REGISTER_URL);
// Open a new connection and register using the encrypted url.
final String encryptedParam = new String(encryptedData);
String encryptedUrl = BBP_SERVER + "/mss/PD_subReg?osversion="
+ getDeviceSoftwareVersion()+ "&model="
+ DeviceInfo.getDeviceName() + "&" + encryptedParam
+ ";ConnectionType=mds-public;deviceside=false";
byte[] statusCodeData = connectAndRead(encryptedUrl);
resultCode= new String(statusCodeData);
// Status code sent back to the application from the BB Push server
String statusCode = new String(statusCodeData);
// Note: Developers should also register with the Content Provider
// in order to notify the server that it can push data to this
// device.
// If registration succeeded then start listening to messages
// from the server.
if( (statusCode.equals(StatusCode.REGISTER_SUCCESSFUL) || statusCode
.equals(StatusCode.USER_ALREADY_SUSCRIBED)))
{
_dataListener = new ListeningThread();
_dataListener.start();
showDialogAndWait("Registration Succeeded."+resultCode+responseCode);
return true;
}
else
{
showDialogAndWait("Registration Failed\nStatus Code: " + statusCode+resultCode+responseCode);
return false;
}
}
catch(final Exception e )
{
showDialogAndWait("Registration Error\n" + e.toString()+resultCode+responseCode);
return false;
}
}