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
Contributor
mavi2312
Posts: 18
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user
Accepted Solution

Push Service plugin for WebWorks 2.0.0.54 (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="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0" version="0.0.1">
<name>Sample</name>
<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"/>
<description>Example</description>
<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">
<type>APPLICATION</type>
<filter>
<action>bb.action.PUSH</action>
<mime-type>application/vnd.push</mime-type>
</filter>
</rim:invoke-target>
<!-- 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">
<type>APPLICATION</type>
<filter>
<action>bb.action.OPEN</action>
<mime-type>text/plain</mime-type>
</filter>
</rim:invoke-target>
</widget>

 


What I did notice was that the function "window.webworks.defineReadOnlyField" is located in the webworks-1.0.4.11.js 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 :smileyvery-happy:

 

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

Please use plain text.
BlackBerry Development Advisor
bryanhiggins
Posts: 201
Registered: ‎12-18-2012
My Device: Z10, Q10, Q5, Z30, Z3
My Carrier: Bell

Re: Push Service plugin for WebWorks 2.0.0.54 (Cordova 3.2)

Hi,

 

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

 

http://plugins.cordova.io/#/com.blackberry.push

Bryan Higgins
BlackBerry WebWorks
@bryanhiggins
Please use plain text.
Contributor
mavi2312
Posts: 18
Registered: ‎09-18-2013
My Device: Developer
My Carrier: Non-BlackBerry user

Re: Push Service plugin for WebWorks 2.0.0.54 (Cordova 3.2)

Perfect timing! Now the plugins works perfect :smileyhappy: thank you very much!

Please use plain text.