1

I am struggling for getting message on devices since last some days. At last I think to take a help from experts.

Below are the steps I have followed.

  1. I have created Push initiator in core java. note: I am getting response code : 200 OK - I assume that this message reaches to PPG for further processing - But not confirmed.

  2. I have used sample Push Enabled Application for Blackberry Device - I could able to register and waiting for messages on perticular port. but I am not receiving any messages :(

Now I am helpless, My question is 1. Does I am in right track 2. Is there any way to find out how to debug and where my messages are hanging.

I am waiting for some positive solution. Thanks in advance..

Here is my actual code for Push initiator for J2SE

StringBuffer dataToSend = new StringBuffer();
    dataToSend.append("--" + BOUNDARY);
    dataToSend.append(" ");
    dataToSend.append("Content-Type: application/xml; charset=UTF-8");
    dataToSend.append(" ");
    dataToSend.append("<?xml version=\"1.0\"?>");
    dataToSend
            .append("<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 2.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd\" [<?wap-pap-ver supported-versions=\"2.0\"?>]>");
    dataToSend.append("<pap>");
    String myPushId = ""+ new Random().nextInt();
    dataToSend.append("<push-message push-id=\"" + myPushId
            + "\" source-reference=\"" + applicationID + "\">");
    dataToSend.append("<address address-value=\"" + pin + "\"/>");
    dataToSend
            .append("<quality-of-service delivery-method=\"confirmed\"/>");
    dataToSend.append("</push-message>");
    dataToSend.append("</pap> ");
    dataToSend.append("--" + BOUNDARY);
    dataToSend.append(" Content-Encoding: binary ");
    dataToSend.append(" Content-Type: text/plain ");
    dataToSend.append(" ");
    dataToSend.append("X-Wap-Application-Id: " + applicationID);
    dataToSend.append(" X-Rim-Push-Type: browser-channel  X-Rim-Push-Title: Test X-Rim-Push-Unread-Icon: http://rim.com/icon_new.png ");
    dataToSend.append("X-Rim-Push-Read-Icon: http://rim.com/icon_viewed.png  ");
            dataToSend.append("X-Rim-Delete-URL: http://rim.com/ReceiveDelete ");
                    dataToSend.append("X-Rim-Transcode-Content: */* ");
                    dataToSend.append("Cache-Control: max-age=3600 ");
    dataToSend.append(msg);
    dataToSend.append("--" + BOUNDARY + "--");
    dataToSend.append(" ");
     printer(dataToSend.toString());
    // printer("-------------------------------------------------------------------");
    String authInfo = applicationID + ":" + userPW;

    String encoding = new sun.misc.BASE64Encoder().encode(authInfo
            .getBytes());
    // authInfo = Base64.encode(authInfo.getBytes());
    authInfo = "Basic " + encoding;
    printer(authInfo);
    URL url;
    HttpURLConnection connection = null;
    try {
        // Create connection
        url = new URL(targetURL);
        connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("POST");
        connection.setRequestProperty("Content-Type",
                "multipart/related; boundary=" + BOUNDARY
                        + "; type=application/xml");
        connection.setRequestProperty("User-Agent",
                "BlackBerry Push Service SDK/1.0");
        // / connection.setRequestProperty("Authorization",
        // authInfo.getBytes().toString());
        connection.setRequestProperty("Authorization", authInfo);

        connection.setRequestProperty("Accept",
                "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2");
        connection.setRequestProperty("Connection", "keep-alive");
        connection.setRequestProperty("Content-Length",
                "" + dataToSend.length());
        connection.setDoInput(true);
        connection.setDoOutput(true);

        // Send request
        DataOutputStream wr = new DataOutputStream(
                connection.getOutputStream());
        wr.writeBytes(dataToSend.toString());
        wr.flush();
        wr.close();

        printer("" + connection.getResponseCode());
        String response = connection.getResponseMessage();

        printer(response);
        // return response;
  • were you able to resolve the issue? I have successfully resolved and can guide if you require any help – Sarah Sep 04 '13 at 07:12
  • @Sarah, I need some guidance. I am using pushsharp on server side to send notification, notification is sent successfully, I checked in debug mode, but in BB, notification is not received. At one time I received sound and red color icon on my app, now even that also stopped coming. – subha Mar 18 '16 at 13:49

0 Answers0