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
Highlighted
Regular Contributor
Posts: 76
Registered: ‎11-13-2012
My Device: curve 9300
My Carrier: mtn

pushwoosh blackberry html5 integration

[ Edited ]

am creating an app using html5 , and so i am trying to integrate and use the pushwoosh plugin for blackberry webworks so i can send and receive notifications, but am stuck up somewhere, from the tutorial on their site

 

 

"http://www.pushwoosh.com/programming-push-notification/blackberry/blackberry-additional-platforms/bl...

 

i dont know where to include this,

 

"PushWoosh.appCode = #####-#####';"

 

can someone please shed more light on this, thanks

 

EDIT: Removed App ID.

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: pushwoosh blackberry html5 integration

Hello kokoman,

 

Indeed the PushWoosh documentation has it in an odd place.

 

Personally, based on the recommendation, I would try modifying PushWoosh.js directly and adding an appCode property. something like:

 

var PushWoosh = {

        appCode: '#####-#####',

	getToken : function() {
		return blackberry.identity.PIN;
	},

        ...

};

PushWoosh.baseurl = 'https://cp.pushwoosh.com/json/1.3/';

 

Alternatively, you could wrap the documented section in its own <script> tags. Example:

 

<script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="pushwoosh.js" type="text/javascript"></script>
<script>PushWoosh.appCode = 'YOUR_PUSHWOOSH_APP_ID';</script>
 
<script src="master.js" type="text/javascript"></script>

 

The last option that comes to mind would be to move the code into a window load event. Example:

 

<script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="pushwoosh.js" type="text/javascript"></script>
<script src="master.js" type="text/javascript"></script>

<script type="text/javascript">
window.addEventListener('load', function () {
PushWoosh.appCode = 'YOUR_PUSHWOOSH_APP_ID';
...
}, false);
</script>

 

Note though that these are more "guesses" than confirmed fixes to the issue. Putting the code as is outlined in the documentation doesn't seem to make much sense to me.

 

If all else fails, reaching out to PushWoosh support may be the way to go:

http://www.pushwoosh.com/contact-us/

 

 

 


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: pushwoosh blackberry html5 integration

I am also unsure whether this will work with BlackBerry 10 WebWorks; it may have been targeted for BlackBerry OS WebWorks.

 

The reason is that the PushWoosh.js file makes reference to:

blackberry.identity.PIN

 

However this API has been deprecated in favour of blackberry.identity.uuid on BlackBerry 10:

https://developer.blackberry.com/html5/apis/blackberry.identity.html#.PIN

 

 

You may be able to get away withi replacing the call to PIN with:

blackberry.identity.uuid.substring(2)

 

The purpose for the substring is that UUID has tended to return the PIN in the format 0x2A00000F and that code will drop the 0x. Though that may not even be necessary.

 

It's worth giving PushWoosh a shot, but definitely a good amount of testing is recommended to ensure everything is working as expected on :BlackBerry 10.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
Posts: 76
Registered: ‎11-13-2012
My Device: curve 9300
My Carrier: mtn

Re: pushwoosh blackberry html5 integration

Hello oros, tanks, ill like to clearify its nt a bb10 app, its bb 5 - 7 targeted, ill try ur solutions, cause presently I gt dis error result of expression: blackberry.push undefined is nt an object
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: pushwoosh blackberry html5 integration

Hm, that error seems to indicate something a little different; specifically that blackberry.push does not exist. Have you configured your config.xml as outlined here?
https://developer.blackberry.com/bbos/html5/apis/blackberry.push.html

Also, are you using the most up-to-date BlackBerry WebWorks SDK for BBOS to package your applications? What is the full version that you are using? (Should be in the WebWorks SDK folder name.)

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
Posts: 76
Registered: ‎11-13-2012
My Device: curve 9300
My Carrier: mtn

Re: pushwoosh blackberry html5 integration

Sorry I forgot to specify, am building using phonegap, can I post my config n code file here so u could check n see whr am missin it
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: pushwoosh blackberry html5 integration

Right, that would make sense since PushWoosh is a PhoneGap plugin, my mistake :-)

You noted you see this error:
blackberry.push undefined isn't an object

Are you using Web Inspector then to debug / is that where you see this error? If so, it would be ideal to see your config.xml and the line of code that is specifically causing the error.

If you haven't been using Web Inspector, that is likely the best way forward; to verify the exact line that causes this problem.

From there, we can investigate that line of code and the surrounding code.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
Posts: 76
Registered: ‎11-13-2012
My Device: curve 9300
My Carrier: mtn

Re: pushwoosh blackberry html5 integration

I already compiled b4 I posted here, Ok I don't use web inspector, can I post my config n my code, u cud help in checkin out
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: pushwoosh blackberry html5 integration

If you're comfortable sharing it sure. I'll do my best to look through it but it really depends on the complexity. If we can't find it in the code, re-compiling in debug mode (i.e. with Web Inspector) and investigating that way will likely be the way to go.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Regular Contributor
Posts: 76
Registered: ‎11-13-2012
My Device: curve 9300
My Carrier: mtn

Re: pushwoosh blackberry html5 integration

Aiite, ill share it tomorw, thanks for your help