Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在BlackBerry中注册推送通知时出现超时异常_Blackberry - Fatal编程技术网

在BlackBerry中注册推送通知时出现超时异常

在BlackBerry中注册推送通知时出现超时异常,blackberry,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 wheth

我正在尝试注册黑莓推送通知,但它显示超时异常

这是我写的代码

 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;
    }
}

您的设备是否以其他方式连接到网络?例如,你能浏览到一个网页吗?推送服务需要网络连接。

在Blackberry推送通知中的简单操作,我通过以下操作获得了成功

使用黑莓设备,它有BIS计划 您的内容提供商应该可以公开访问