01-15-2010 08:56 AM
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 :
<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 :
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
Windows VISTA 32 SP2
Blackberry simulators 220.127.116.110 / 18.104.22.1684
MDS Simulator 4.1.4
Solved! Go to Solution.
01-15-2010 11:50 AM
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.
tml" /> <access uri="http://localhost:8080" subdomains="true"> <feature id="blackberry.system" /> </access>