0

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 ??

Nate
  • 31,017
  • 13
  • 83
  • 207
Deepak
  • 54
  • 2
  • 10
  • first you search on stackoverflow. you will get too much answers for this – Rince Thomas Nov 02 '12 at 06:50
  • http://stackoverflow.com/search?q=Blackberry+Push+Client+Application+Blackberry+Registration+failed – Rince Thomas Nov 02 '12 at 06:58
  • Hi @Black Pearl , i been going through stackoverflow searching for a solution, and havent found any. – Deepak Nov 05 '12 at 05:09
  • did you check this ?http://stackoverflow.com/questions/12049705/cannot-register-in-sample-blackberry-push-application – Rince Thomas Nov 05 '12 at 05:41
  • http://rincethomas.blogspot.in/2012/07/push-notification-in-blackberry.html – Rince Thomas Nov 05 '12 at 06:02
  • @Black Pearl yeah.. i did check http://stackoverflow.com/questions/12049705/cannot-register-in-sample-blackberry-push-application – Deepak Nov 05 '12 at 06:20
  • I have implemented in a similar way mentioned in the blog except that i use a wifi connection. and the url will be like http://cpXXX.pushapi.eval.blackberry.com/mss/PD_subReg?serviceid='My Application Id'&osversion='My OS Version'&model='Device Model';interface=wifi – Deepak Nov 05 '12 at 06:24
  • @BlackPearl the problem is right now, i'm only having a wifi connectivity. There is no sim with BIS activation . Is BIS necessary to register the device ?? While trying , I am getting DNS exception – Deepak Nov 05 '12 at 06:39
  • ohhh.... You need a sim and a BIS connection for registering your devise. – Rince Thomas Nov 05 '12 at 06:51
  • @BlackPearl i think BIS connection needed only to receive the push notifications , because RIM uses BIS to send the notifications to the device?? Is it necessary to use the BIS for device registration also?? – Deepak Nov 05 '12 at 07:01
  • yes @Deepak, if you need to register, you have a active BIS connection – Rince Thomas Nov 05 '12 at 07:10
  • @BlackPearl , Thanks for helping me. I will try it and post the results. Can i get your mail id?? – Deepak Nov 05 '12 at 07:13
  • @BlackPearl , thanks a lot for spending time with me, i activated BIS plan on a sim and tried it. Its wroking. – Deepak Nov 05 '12 at 13:07

1 Answers1

0

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.

Deepak
  • 54
  • 2
  • 10