Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520
Accepted Solution

How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

 

 

Please guide me  with

 

 

Client side SDk

 

Server side  SDK  

 

 

i.e the code etc  with API

 

 

I have alreday publshed html5 app  in the app world.

 

 

 

Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

Here is the documentation on how to use push in a WebWorks application for BlackBerry 7.0:

https://developer.blackberry.com/bbos/html5/apis/blackberry.push.html

 

For the server side, here is the Push Service SDK documentation:

https://developer.blackberry.com/devzone/develop/platform_services/push_service_sdk.html

 

 

However, I would recommend using a service like Urban Airship for your server-side push management.  They have already built all the pieces of the puzzle, and you can create a new account and send push messages through that service.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

However, I would recommend using a service like Urban Airship for your server-side push management. They have already built all the pieces of the puzzle, and you can create a new account and send push messages through that service

 

what  do you mean by Urban Airship for your server-side push management.  

 

Can you be  little brief about srver side implemntation .

 

 

Any How Iam working  on the links  given by you laready and thanks for it.

 

 

 

 

Developer
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

Hi, is it possible to use Urban Airship to send a push notification to the hub? So that when they see the notification the user would click open and then it would take them to that page in the app, or is that not possible? Thanks

Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

Hi Tobster      Iam starting the push notifications now, please ask your queries to  stanley.

Developer
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

[ Edited ]

Will do, thanks :smileyhappy:

Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

Hi  stanley I have installed the SDK  from the link 

 

https://developer.blackberry.com/devzone/develop/platform_services/push_service_sdk.html

 

 

can you please explain me now step by step as  to Ho wto begin.

 

 

My application  contains

 

index.html

 

config.xml

 

main.js

 

images folder

 

etc

 

 

How to begin wth the code ?

 

 

 

 

Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

My Target is to  push notifications into my App and my app   should Listed or recieve the notifications  and show the notifications to the users on the mobile.  

Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

[ Edited ]

Yes this is correct.

 

1. The remote service sending the push (e.g. Urban Airship) sends the message to your device

2. Your device receives the message and sends it to your app (as long as your app is registered as a push listener target)

3. Your app can then send a notification message to the Hub / Inbox to let your users know there is new content in your app.

4. When a user clicks on the inbox notification, the OS launches your app

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
srk2012
Posts: 672
Registered: ‎12-04-2012
My Device: BlackBerry 8520

Re: How to push notifications into Blacknberry html5 applications for Bb 7.0 OS mobiles etc

[ Edited ]

Shall I write or include the code as    below in my application's       index.html       now   then 

 

 

Code Example:

<script type="text/javascript">
  var port = 153;
  var serverUrl = "http://pushapi.eval.blackberry.com";
  var appId = "my application id";
  var max = 100;
  var wakeUpPage = "push.htm";
  function openBISPushListener() {
    try {
      var ops = {port : port, appId : appId, serverUrl : serverUrl, wakeUpPage : 'push.htm', maxQueueCap : max};
      blackberry.push.openBISPushListener(ops, onData, onRegister, onSimChange);
    }
    catch (err) {
      alert(err);
    }     
  } 

  function onRegister(status) {
    if (status == 0) {
      alert("success");
    }
    else if (status == 1) {
      alert("network error");
    }
    else if (status == 2) {
      alert("rejected by server");
    }
    else if (status == 3) {
      alert("invalid parameters");
    }
    else if (status == -1) {
      alert("general error");
    }
    else {
      alert("unknown status");
    }
  }
	
  function onData(data) {
    var resultDiv = document.getElementById("resultDiv");
    try {
      resultDiv.innerHTML += "<br>" + blackberry.utils.blobToString(data.payload);
      return 0; //indicate acceptance of payload for reliable push
    } 
    catch (err) {
      alert(err);
    }
  }

  function onSimChange() {
    var resultDiv = document.getElementById("resultDiv");
    resultDiv.innerHTML += "<br>" + "SIM card is changed!";
  }
</script>