Question

I am quite new to blackberry application development and i need to create an application which can receive push notifications.

I have created the application and was trying to use xtify for pushing notifications to devices.

I have registered with rim for the push evaluation and got the credentials like url,app id,password etc.

When the application launches , i create a new thread to perform the push registration process. I try to send an http Get request to the push evaluation url for registering the device.When i try to open a connection,i get the io exception,invalid url parameter.

I am using a wifi connection for network connectivity in device. I donot have a sim in the device. The url is

http://cpXXX.pushapi.eval.blackberry.com/mss/PD_subReg?serviceid='My Application Id'&osversion='My OS Version'&model='Device Model';deviceside=false;ConnectionType=mds-public

Below is the code i use to send the request.

    DataBuffer buffer = new DataBuffer(256, false);
    httpUrl = "http://cpXXX.pushapi.eval.blackberry.com/mss/PD_subReg?serviceid='My Application Id'&osversion='My OS Version'&model='Device Model';deviceside=false;ConnectionType=mds-public"

    InputStream inputStream = null;
    Connection conn = null;
    HttpConnection httpConn = null;
    try {
        httpUrl ;
        conn = Connector.open(httpUrl);
        if (conn instanceof HttpConnection) {
            httpConn = (HttpConnection) conn;
            int responseCode = httpConn.getResponseCode();
            if(responseCode == 200){
                inputStream = httpConn.openInputStream();
                int length = inputStream.read(buffer.getArray());
                buffer.setLength(length);
                String response = new String( buffer.getArray(), buffer.getArrayStart(), buffer.getArrayLength() );
                return response;
            }else { 
                throw new IOException( "Http error: " + responseCode);
            }
        }

        else {
            throw new IOException("Can not make HTTP connection for URL '"
                    + httpUrl + "'");
        }

    }
    finally {
        if (httpConn != null) {
            try {
                httpConn.close();
            } catch (IOException e) {
                System.out.println(e.getMessage());
                e.printStackTrace();
            }
        }
        close(conn, inputStream, null);
    }

Please help me. I am waiting for replies. I have been stuck with this for days. Please advice. Anyone have idea where i can get a documentation for the device registration api ??

Was it helpful?

Solution

Thanx to the advice of @Black Pearl , I was able to resolve the issue. Inorder for the blackberry registration to work , you need an active BIS connection. I had been trying it with wifi connectivity and hence it was not working.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top