05-04-2012 04:15 PM
hello all BB developers,
this is the fact, a college gave me the code of her proyect made with WebWorks (html5 / javascirpt), i need to make that proyect run when the user enter in the browser a espeficit URL, i already made that with a helloworld the problem is that hellowolrd app is also made in jave, (i use the httpfilter demo class and configure it for my own needs).
soo at the need i need a way to make that proyect made in webworks run when user introduce a especific URL in the browser
05-07-2012 09:11 AM
Hello,
WebWorks applications support custom JavaScript extensions. These are JavaScript wrappers for Java code.
What you could do is create an extension that runs when the Webworks app is first started. This extension can register that app using HttpFilter with a given URL. It should then allow you to capture when users have entered a given URL in the browser.
Here is a TEMPLATE extension you can download and use to get started:
https://github.com/blackberry/WebWorks-Community-A
Also, here is a tutorial on how to build your own JavaScript extension for WebWorks applications:
Best wishes,
05-08-2012 06:36 PM
thx for the reply, looks complicated, i am tryings to undertand the code , and just for know did u run that test_app ?? u get 9 test failed and only one pass??
test("object", function(){
"use strict";
expect(2);
//Setup test:
var typeofObjA, typeofObjB;
try {
typeofObjA = (typeof blackberry);
typeofObjB = (typeof blackberry.template);
} catch(e) {
console.log("blackberry object not found");
}
//Run the test
equal(typeofObjA, "object", "'blackberry' JavaScript object exists in ScriptEngine.");
equal(typeofObjB, "object", "'blackberry.template' JavaScript object exists in ScriptEngine.");
//Test teardown:
});
i mean the test blackberry.template fail is not on the ScriptEngine WTF????
05-08-2012 10:42 PM
Yes it is a rather advanced topic. Not for the feint of heart.
That many failures tells me something else is going on - and it looks like the blackberry.template extension is not configured correctly or hasn't been added to the WebWorks SDK. As a result, the runtime envionment may simply not recognize the "blackberry.template" object.
Did you follow the instructions in the "how to install this extension":
https://github.com/blackberry/WebWorks-Community-A
05-09-2012 10:15 AM
yes i installed its easy i copy the blackberry.template file in C:\Program Files\Research In Motion\BlackBerry WebWorks SDK 2.3.1.5\ext instead of C:\Program Files\Research In Motion\BlackBerry WebWorks Packager\ext.
by the way i try with another files like blackberry.app that was already there and the test fail o.O, i read some about test it with web inspector ?? maybe only tworks with the inspector and not with ripple??
try {
typeofObjA = (typeof blackberry);
typeofObjB = (typeof blackberry.app); <----------------------
} catch(e) {
console.log("blackberry object not found");
}
//Run the test
equal(typeofObjA, "object", "'blackberry' JavaScript object exists
in ScriptEngine.");
equal(typeofObjB, "object", "'blackberry.template' JavaScript
object exists in ScriptEngine.");
//Test teardown:
});
05-10-2012 06:01 PM
reply plox ;(
05-10-2012 06:49 PM
u test the app in my blackberry phone and i get 14 test successfull of 16, i dont know why in the ripple emulater just get 1 test successfull. but well i can work now but is a pain in the **bleep** test the app only in the phone
, and btw if when i try to run the bb emulator in the simulator i cant. =/
05-11-2012 09:56 AM
Can I suggest two more items:
1) The failures you are seeing, with the blackberry.app object not being available, could have to do with the fact that object is not available at runtime. This could be due to a missing config.xml feature.
Make sure you have the blackberry.app.event feature properly whitelisted in your config.xml file
<feature id="blackberry.app.event" required="true" version="1.0.0.0"/>
2) In Ripple, if you are seeing none of these objects being available, can you confirm that you have the correct Platform loaded. From the left side of the screen, expand the "Platforms" panel, and select either 'WebWorks' or 'WebWorks-TabletOS'.
This should load the blackberry.* objects that you have whitelisted in your config.xml into memory, and make them available to your content.
Cheers,
Adam