Blackberry Push notification without Rhosync and Rhoconnect

73 views
Skip to first unread message

inchara

unread,
Jan 6, 2014, 2:36:47 AM1/6/14
to rhom...@googlegroups.com
Hi All,

I have rhodes application for push notification and .net service is there to send notification(giving appid, password). But not getting notification on device.
Below find the build.yml:
Capabilities:
  -push
And also i have uncommentted this line "push.application.reliable.ports=100" in rimpublic.property file
Please help me its very urgent.

Thanks in advance

Burgess Lars-KDWC48

unread,
Jan 6, 2014, 3:37:19 PM1/6/14
to <rhomobile@googlegroups.com>, rhom...@googlegroups.com
Are you using RMS v3.5 or older? As of RMS v4.0, blackberry is no longer supported.

-Lars
--
You received this message because you are subscribed to the Google Groups "rhomobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rhomobile+...@googlegroups.com.
To post to this group, send email to rhom...@googlegroups.com.
Visit this group at http://groups.google.com/group/rhomobile.
For more options, visit https://groups.google.com/groups/opt_out.

Venkatanagalakshmi p

unread,
Jan 6, 2014, 9:04:40 PM1/6/14
to rhom...@googlegroups.com

I am using v3.5

Burgess Lars-KDWC48

unread,
Jan 7, 2014, 11:02:57 AM1/7/14
to rhom...@googlegroups.com

Strange, maybe your .NET code that sends a push message to RIM server is not working.  For reference, here's how RhoConnect did it up until v3.4: https://gist.github.com/larsburgess/bdd6288598acf0f103dc


-Lars



From: rhom...@googlegroups.com <rhom...@googlegroups.com> on behalf of Venkatanagalakshmi p <vnlak...@gmail.com>
Sent: Monday, January 6, 2014 6:04 PM
To: rhom...@googlegroups.com
Subject: Re: [rhomobile] Blackberry Push notification without Rhosync and Rhoconnect
 

Venkatanagalakshmi p

unread,
Jan 7, 2014, 11:28:01 AM1/7/14
to rhom...@googlegroups.com

I have registered my application with blackberry push service. Using app id and password in .net application. I have checked with native blackberry application with .net service. Its working fine. But am not getting why its not working with rhomobile application.

Burgess Lars-KDWC48

unread,
Jan 7, 2014, 12:01:46 PM1/7/14
to rhom...@googlegroups.com

Are you handling the registration info coming in from the device?  Short of that I'm not sure what it could be.  It works fine when RhoConnect is the server (v3.4.x), using the code you see below.


-Lars



From: rhom...@googlegroups.com <rhom...@googlegroups.com> on behalf of Venkatanagalakshmi p <vnlak...@gmail.com>
Sent: Tuesday, January 7, 2014 8:28 AM
To: rhom...@googlegroups.com
Subject: RE: [rhomobile] Blackberry Push notification without Rhosync and Rhoconnect
 

Venkatanagalakshmi p

unread,
Jan 7, 2014, 12:05:03 PM1/7/14
to rhom...@googlegroups.com

Can you please tell me how to handle registration in client application?

Burgess Lars-KDWC48

unread,
Jan 7, 2014, 1:01:07 PM1/7/14
to rhom...@googlegroups.com
It's not your client app that handles registration, it's your server.  Your server needs to receive registration info from the client so it knows how to route push messages.  RhoConnect just exposes a rest end point that receives an HTTP POST from the client.  You could do the same in the .NET app.

-Lars



From: rhom...@googlegroups.com <rhom...@googlegroups.com> on behalf of Venkatanagalakshmi p <vnlak...@gmail.com>
Sent: Tuesday, January 7, 2014 9:05 AM

inchara

unread,
Jan 7, 2014, 11:31:18 PM1/7/14
to rhom...@googlegroups.com
public void pushMessage(string pushedMessage, string pushPin)
        {
            String appid = "4476-586l75e708rr8619a4f0495c30y5862kMi1";
            String password = "6kfuiks55652";
            String deliverbefore = DateTime.UtcNow.AddMinutes(5).ToString("s", System.Globalization.CultureInfo.InvariantCulture) + "Z";
            String Boundary = "mPsbVQo0a68eIL3OAxnm";

            StringBuilder dataToSend = new StringBuilder();

            dataToSend.AppendLine("--" + Boundary);
            dataToSend.AppendLine("Content-Type: application/xml; charset=UTF-8");
            dataToSend.AppendLine("");
            dataToSend.AppendLine("<?xml version=\"1.0\"?>");
            dataToSend.AppendLine("<!DOCTYPE pap PUBLIC \"-//WAPFORUM//DTD PAP 2.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/pap_2.1.dtd\">");
            dataToSend.AppendLine("<pap>");
            string myPushId = DateTime.Now.ToFileTime().ToString();
            dataToSend.AppendLine("<push-message push-id=" + (char)34 + myPushId + (char)34 + " deliver-before-timestamp=" +
            (char)34 + deliverbefore + (char)34 + " source-reference=" + (char)34 + appid + (char)34 + ">");
            //dataToSend.AppendLine("<push-message push-id=\"" + myPushId + "\" source-reference=\"" + appid + "\">");
            dataToSend.AppendLine("<address address-value=\"" + pushPin + "\"/>");
            dataToSend.AppendLine("<quality-of-service delivery-method=\"unconfirmed\"/>");
            dataToSend.AppendLine("</push-message>");
            dataToSend.AppendLine("</pap>");
            dataToSend.AppendLine("--" + Boundary);
            dataToSend.AppendLine("Content-Type: text/plain");
            dataToSend.AppendLine("Push-Message-ID: " + myPushId);
            dataToSend.AppendLine("");
            dataToSend.AppendLine(pushedMessage);

            dataToSend.AppendLine("--" + Boundary + "--");
            dataToSend.AppendLine("");

            byte[] bytes = Encoding.ASCII.GetBytes(dataToSend.ToString());

            WebRequest tRequest;
            tRequest = WebRequest.Create(httpURL);
            tRequest.Method = "POST";
            tRequest.Credentials = new NetworkCredential(appid, password);
            tRequest.PreAuthenticate = true;
            tRequest.ContentType = "multipart/related; boundary=" + Boundary + "; type=application/xml";
            tRequest.ContentLength = bytes.Length;
            string rawCredentials = string.Format("{0}:{1}", appid, password);
            tRequest.Headers.Add("Authorization", string.Format("Basic {0}",
            Convert.ToBase64String(Encoding.UTF8.GetBytes(rawCredentials))));
            SetBasicAuthHeader(tRequest, appid, password);

            Stream dataStream = tRequest.GetRequestStream();
            dataStream.Write(bytes, 0, bytes.Length);
            dataStream.Close();

            WebResponse tResponse = tRequest.GetResponse();
            dataStream = tResponse.GetResponseStream();
            StreamReader tReader = new StreamReader(dataStream);
            String sResponseFromServer = tReader.ReadToEnd();

            tReader.Close();
            dataStream.Close();
            tResponse.Close();
        }
        public static void SetBasicAuthHeader(WebRequest req, String appID, String userPassword)
        {
            string authInfo = appID + ":" + userPassword;
            authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
            req.Headers["Authorization"] = "Basic " + authInfo;
        }

Above is my .Net code for sending push message

Burgess Lars-KDWC48

unread,
Jan 8, 2014, 12:21:05 AM1/8/14
to rhom...@googlegroups.com

Is this using the blackberry BIS push service?  Please remember that rhodes only supported BES PAP push (via BES instance).  Correct me if I'm wrong but I believe the cloud push service is BIS push.  You might need to change your code if that's the case.


-Lars



From: rhom...@googlegroups.com <rhom...@googlegroups.com> on behalf of inchara <vnlak...@gmail.com>
Sent: Tuesday, January 7, 2014 8:31 PM

inchara

unread,
Jan 8, 2014, 1:43:04 AM1/8/14
to rhom...@googlegroups.com
Yes this use blackberry BIS push service. How can we differentiate BIS from BES? Thanks 

Burgess Lars-KDWC48

unread,
Jan 8, 2014, 1:59:06 AM1/8/14
to rhom...@googlegroups.com

I was going off the fact that you're using the cloud service as opposed to your own running BES server.  If you are using BIS then it will not work with rhodes.


-Lars



Sent: Tuesday, January 7, 2014 10:43 PM

inchara

unread,
Jan 8, 2014, 2:19:24 AM1/8/14
to rhom...@googlegroups.com
OK. Thanks for your great support. I will rewrite my .net service. I am new to this blackberry push notification not getting what to do.

inchara

unread,
Jan 9, 2014, 6:39:01 AM1/9/14
to rhom...@googlegroups.com
Hi Lars,

I am using below code for subscription is this correct? Plz help me

def get
  $device = System.get_property('device_id')
  Alert.show_popup $device.to_i.to_s(base=16).upcase
  @@url = "http://cp2576.pushapi.eval.blackberry.com/mss/PD_subReg?serviceid=2576-253695e708rr8619a4f0495c30y2595kMi1&osversion="+ System.get_property('os_version')+"&model="+System.get_property('device_name')
  Alert.show_popup @@url
  Rho::AsyncHttp.post(
     :url => @@url,
     :callback => (url_for :action => :httpget_callbackCheckConfig),
     :callback_param => "")
 
     redirect :action => :wait
end

  def httpget_callbackCheckConfig
      if System.get_property('has_network') == true
        puts "httpget_callbackCheckConfig: #{@params}"
        if @params['status'] != 'ok'
          @@error_params = @params
          Alert.show_popup 'System is temporarily unavailable. Please try again later'          
          WebView.navigate ( url_for :action => :index)
        else
          @response = @params["body"]
          puts @response
          begin  
            Alert.show_popup @params["body"] 
             
            @@url = "https://122.252.122.362:8523/high-level-sample/subscribe?username=f...@gmail.com&password=errdf&appid=2576-253695e708rr8619a4f0495c30y2595kMi1&address=#{$device.to_i.to_s(base=16).upcase}&osversion="+ System.get_property('os_version')+"&type=enterprise&model="+System.get_property('device_name')+"&field1=1000"
              Alert.show_popup @@url
              Rho::AsyncHttp.post(
                 :url => @@url,
                 :callback => (url_for :action => :httpget_callbackConfig),
                 :callback_param => "")
             
                 redirect :action => :wait      
            #WebView.navigate ( url_for :action => :index)
  
          end
        end
      else
        Alert.show_popup 'No network available. Please try again later'
        WebView.navigate ( url_for :action => :index)
      end
    end

    def httpget_callbackConfig
      if System.get_property('has_network') == true
              puts "httpget_callbackCheckConfig: #{@params}"
              if @params['status'] != 'ok'
                @@error_params = @params
                Alert.show_popup 'System is temporarily unavailable. Please try again later'                
                WebView.navigate ( url_for :action => :index)
              else
                @response = @params["body"]
                puts @response
                begin  
                  Alert.show_popup @params["body"]                    
                     
                  WebView.navigate ( url_for :action => :index)
        
                end
              end
            else
              Alert.show_popup 'No network available. Please try again later'
              WebView.navigate ( url_for :action => :index)
            end
    end

Burgess Lars-KDWC48

unread,
Jan 9, 2014, 5:43:51 PM1/9/14
to rhom...@googlegroups.com
That's a good question,  I'm afraid I won't be able to help much here as I haven't personally used the BIS push service.  

I would assume that their sample code for client-side registration would be a good starting point for the task of porting over to ruby (looks like you may already be doing that to some degree).  But the specifics and whether or not it will work for you are really pretty involved implementation details in your app.  If you have a specific bug to report on the framework with isolated repro steps then we can help.

-Lars



Sent: Thursday, January 9, 2014 3:39 AM

inchara

unread,
Jan 9, 2014, 11:28:00 PM1/9/14
to rhom...@googlegroups.com
Thank you so much for your support. Registration all successfully done. But not getting notification message on device. Please help me
Reply all
Reply to author
Forward
0 new messages