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

New Developer
Posts: 2
Registered: ‎01-15-2010
My Device: BOLD 9700
My Carrier: SFR
Accepted Solution

Issue Widet SDK API and namespace with the avoid recompiling method



I'm having fun with the Widget SDK Beta 2 which is a great tool.


I followed the instructions from this tutorial, in order to avoid recompiling my widget after modification :



It works perfectly and it is really efficient ... if I stick to native JS functions...


But now I'm experiencing an issue when using RIM API, and objects within the "blackberry" namespace.


The  "blackberry" namespace seems to exists because I can trace it in an alert box.

But when I want to access blackberry.system.model for example (as explained in the tutorial), I got an error. Well In fact I don't get any error but the code is not executed.

Same issue with other objects within the blackberry namespace (blackberry.pim.Address, blackberry.identity.. whatever..)

When I trace them in an alert box they're undefined.


Sample code from config.xml file :

   <content src="http://localhost:8080/HelloWorld2/BB3/index.html" />
   <access uri="http://localhost:8080" subdomains="true"/>
   <feature id="blackberry.system" />

I'm using localhost on 8080 but it would not be an issue would it ?

Anyway, on 80 default port : same issue


Sample code from index.html file :


<script type=text/javascript" src="http://localhost:8080/HelloWorld2/BB3/scripts.js></scripts>


I've tried either absolute or relative path : same issue


I've tried to compile the widget in a classic way (embedding all files in the zip package without references to external resources) and it works perfectly ! but not really efficient during development.


Is there any way to access objects in blackberry namescape when using the "avoid recompile method" or am I missing something ???


Another question about debugging process :

How can I get some feedbback about what's going on in the widget, without using the alert box. I'm used to debugging my JS with the firebug extension for firefox. Is there any tool like this for the BlackBerry widget ? Or do I have to write my own debugger and surround my code with a big try... catch ?


Your answers and help will be greatly appreciated !




PS. Excuse me for my poor english, french guy is here Smiley Wink


Windows VISTA 32 SP2

Netbeans 6.8

Blackberry simulators /

MDS Simulator 4.1.4



Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Issue Widet SDK API and namespace with the avoid recompiling method

Hi There,


The issue is that your <feature> elements are at the root of the config.xml's <widget> element.


Access to any feature is based on origin.  So when the feature element is declared at the root of the <widget> element you are declaring the functionality for the "local" origin.  That is why when you have all your resources embedded in the widget it is working fine.


In order to make these APIs available for the content you are drawing in from an outside resource, you need to make your <feature> element a sub-element of the <access> element which allows the outside domain.



<content src="http://localhost:8080/HelloWorld2/BB3/index.html" />
<access uri="http://localhost:8080" subdomains="true">
  <feature id="blackberry.system" />



Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Developer
Posts: 2
Registered: ‎01-15-2010
My Device: BOLD 9700
My Carrier: SFR

Re: Issue Widet SDK API and namespace with the avoid recompiling method

Works perfectly thanx Smiley Happy