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

Posts: 20
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user
Accepted Solution

Push Service plugin for WebWorks (Cordova 3.2)

[ Edited ]

Hello! I'm trying to use the Push Service plugin in my app. I added the plugin through the command line, and checked that the com.blackberry.push folder was infact inside my plugins folder in my project. I ran the app in my device and the Web Inspector gave the next error:


TypeError: 'undefined' is not an object (evaluating 'window.webworks.defineReadOnlyField')


This error appears when the plugin tries to define the push constants like SUCCESS or INVALID_PPG_SUBSCRIBER_STATE, so obviously the plugin never starts to work and I can't use the push service.


I have my Push credentials fine (they work fine in my OS 7 app), and I was very carefull when I wrote the config.xml file. Here it is:


<widget id="Sample"
xmlns:cdv="http://cordova.apache.org/ns/1.0" version="0.0.1">
<license href="http://www.apache.org/licenses/LICENSE-2.0"/>
<author email="something@somwhat.com" href="http://www.something.com">Something</author>
<content src="splash.html"/>

<access uri="http://www.mypushserver.com/Registro_Portalesv4/modules/Register" subdomains="true"></access>

<access origin="*"/>
<preference name="fullscreen" value="true"/>
<preference name="webviewbounce" value="true"/>
<icon src="img/icono.png"/>
<feature id="blackberry.app"/>
<feature id="blackberry.push" />
<feature id="blackberry.system" />
<feature id="blackberry.invoked" />
<feature id="blackberry.ui.dialog" />
<feature id="org.apache.cordova" required="true" version="1.0.0" />
<rim: permissions>*
<rim: permit>access_shared</rim: permit>
<rim: permit>post_notification</rim: permit>
<rim: permit system="true">_sys_use_consumer_push</rim: permit>
<rim: permit>read_device_identifying_information</rim: permit>
<rim: permit>access_pimdomain_messages</rim: permit>
<rim: permit>bbm_connect</rim: permit>
<rim: permit>run_when_backgrounded</rim: permit>
</rim: permissions>
<rim:invoke-target id="example.sample.invoke.push">
<!-- Have an invoke entry here for when a notification is clicked on in the BlackBerry Hub -->
<!-- This will cause the application to be opened -->
<rim:invoke-target id="example.sample10.invoke.open">


What I did notice was that the function "window.webworks.defineReadOnlyField" is located in the webworks- file wich I don't have included in my project because I'm using cordova.js as the new SDK suggested. So I think that maybe the push plugin is not updated for the new SDK or I'm missing something as well.

Any ideas? Thanks in advanced Smiley Very Happy


*I put a space in the <rim: permit></rim: permit> tags to avoid having a smiley Smiley Tongue showing in the post, so it's easier to read. In my project there is no spaces between the ":" and the "p"

Posts: 203
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3
My Carrier: Bell

Re: Push Service plugin for WebWorks (Cordova 3.2)



An update was just pushed to the cordova registry which should fix this problem.



Bryan Higgins
BlackBerry WebWorks
Posts: 20
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user

Re: Push Service plugin for WebWorks (Cordova 3.2)

Perfect timing! Now the plugins works perfect Smiley Happy thank you very much!