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

Blackberry.utils not working properly

The Blackberry.utils package isn't working as documented in the latest WebWorks SDK. 

First of all, the namespace defined for it is wrong, according to the documentation it should be Blackberry.utils, but it's actually just 'Utils' (at least for me). The bar packager can't find a feature with id 'blackberry.utils' unless you manually edit the manifest to say 'blackberry.utils' in stead of just 'utils'.

But even then, it's missing funtions like blackberry.utils.stringToBlob.

Because of this I can't create/save/load files using the WebWorks SDK, is this a problem on my end or is there something wrong with this version of the SDK? (I already tried reinstalling)

Please click the like button if my post helped you! Thank you.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Blackberry.utils not working properly

Hi there,

Just to quickly confirm, which version of the BlackBerry WebWorks SDK are you using? (BBOS, BB10, etc.)

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

Re: Blackberry.utils not working properly

That was quick! :smileyhappy:

I'm using BlackBerry 10 WebWorks SDK 1.0.4.11.

Please click the like button if my post helped you! Thank you.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Blackberry.utils not working properly

Ah yes, that would explain it then. The Utils API isn't available on BlackBerry 10:
https://developer.blackberry.com/bbos/html5/apis/blackberry.utils.html

It was only available on BBOS and PlayBook. If we check the BB10 docs, it's no longer listed in the API reference:
https://developer.blackberry.com/html5/apis/

To save/load/create files using the BlackBerry 10 SDK, we now have the HTML5 Filesystem APIs that shouldn't require the Utils APIs:
https://developer.blackberry.com/html5/apis/blackberry.io.html

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

Re: Blackberry.utils not working properly

Ah, I see, I found the filesytem docs very confusing, but I should've noticed that utils wasn't available on BB10 :smileywink:

Thank you!

Please click the like button if my post helped you! Thank you.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10

Re: Blackberry.utils not working properly

HTML5 Filesystem APIs are notoriously difficult to get started with in my experience, but one day it all just clicks :-)

Feel free to kick off some new threads with any questions you may have in that area. This sample shows some basic filesystem access which may help getting started.
https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/canvasToFilesystem

HTML5 Rocks also have a great tutorial on filesystem:
http://www.html5rocks.com/en/tutorials/file/filesystem/

Note that by default, these APIs are accessing the filesystem within the application sandbox; though there is a WebWorks flag you can leverage to work with the filesystem in the shared space (additional sample code at the top of the page.)
http://developer.blackberry.com/html5/apis/blackberry.io.html#.sandbox

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.