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
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Old WebWorks community plugin in 2.0?

I was planing on using "community.vibration" (https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10/VIBRATION) in a WebWorks app, but I would like to use WebWorks 2.0. Is it possible to somehow use this plugin in 2.0 or will I just have to go with Cordova's "navigator.notification.vibrate"? (I'd like to use the "intensity" variable from the community API)

Please click the like button if my post helped you! Thank you.
Developer
Posts: 164
Registered: ‎11-27-2012
My Device: Z10 LE,Dev Alpha C
My Carrier: China Mobile

Re: Old WebWorks community plugin in 2.0?

You can try org.apache.cordova.dialogs plugin,then:

```
navigator.notification.vibrate(milliseconds)
```
BlackBerry Cascades / WebWorks developer, Vendor name: anpho
Developer
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: Old WebWorks community plugin in 2.0?

I know, I said that in my original post, but I would like to control the intensity of the vibrations like the old community API allowed me to do...

Please click the like button if my post helped you! Thank you.
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Old WebWorks community plugin in 2.0?

Seems the BB10-Cordova section of the repo was updated a few days ago, including this community API:
https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/VIBRATION

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.
Developer
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: Old WebWorks community plugin in 2.0?

Okay, I'm trying the cordova plugin, but I keep getting "SyntaxError: JSON Parse error: Unexpected identifier "vibration_request"", even in the sample app 

Please click the like button if my post helped you! Thank you.
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Old WebWorks community plugin in 2.0?

I just gave this a shot and everything seems to be working just fine on my end. My steps were as follows.

 

  1. Create a new project from the command line using the following command: webworks create vibration
  2. Navigate into the new project using the command: cd vibration
  3. Add the vibration plugin by executing the following command: webwork plugin add com.blackberry.community.vibration
  4. Deleted the contents of C:\webworks\vibration\www
  5. Copied the contents of the sample www folder to my C:\webworks\vibration\www folder. Specifically, these files: https://github.com/blackberry/WebWorks-Community-APIs/tree/master/BB10-Cordova/VIBRATION/sample/www
  6. Deployed the project by executing: webworks run

From there, I could play the game on my device (Z30 running 10.2.1) and the device vibrated when I picked the wrong square as expected.


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.
Developer
Posts: 123
Registered: ‎02-13-2012
My Device: Z10 LE
My Carrier: Mobistar

Re: Old WebWorks community plugin in 2.0?

The sample does work, but if you look in the web inspector you'll see that the plugin throws an error, breaking code execution!
Please click the like button if my post helped you! Thank you.
Highlighted
Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Old WebWorks community plugin in 2.0?

Ah, you are indeed correct, the sample continued to work so I thought it meant it was okay, but connecting Web Inspector did throw that error for me (though the sample itself did continue to work.)

I've logged the issue here, but feel free to add any additional information:
https://github.com/blackberry/WebWorks-Community-APIs/issues/257

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: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Old WebWorks community plugin in 2.0?

I'll take a look - it's likely just a small mistake we made in the porting process.

Tim Windsor
Open Source Technical Lead
Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Old WebWorks community plugin in 2.0?

Fix is in - check out the latest version (1.0.1) from the repository, or the cordova plugin registry

Tim Windsor
Open Source Technical Lead