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
New Contributor
adiaz_caixa
Posts: 5
Registered: ‎12-03-2010
My Device: Not Specified
Accepted Solution

Widget: read parameters from command line invoke

Hi,

 

I am using a Blackberry Web Plugin for Eclipse Version:  2.5.0.201009142140-15.

 

I am trying to call a widget from a Java Application, passing one parameter to the main html page.

 

My config.xml has the following line

 

 

<content src="http://external_server/index.html" rim:allowInvokeParams="true"/>

 

 

 

In the Java application I try to call:

 

 

String param = "TestParam"
String url = "TestObjJava?param=" + param; ApplicationManager appmanager = ApplicationManager.getApplicationManager(); appmanager.launchApplication(url);

 

This launches the application, but params are lost, in the widget the window.location.href has the followind value:

 

http://external_server/index.html

 

so I cannot read the TestParam inside my Widget.

 

 

Is possible to read the invoke params from inside the widget javascript?

 

 

Developer
agungeddy
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Widget: read parameters from command line invoke

[ Edited ]

looks like your java code is type mismatch syntax, should be:

 

String url = "TestObjJava?" + param;

 

or if have more than one params :

 

String url = "TestObjJava?" + param1 + "&" + param2 + "&" + param3;

see the references:

 

http://www.blackberry.com/developers/docs/4.7.0api/net/rim/device/api/system/ApplicationManager.html...

or:
 http://www.blackberry.com/developers/docs/6.0.0api/net/rim/device/api/system/ApplicationManager.html...

 

 

 

 

 

New Contributor
adiaz_caixa
Posts: 5
Registered: ‎12-03-2010
My Device: Not Specified

Re: Widget: read parameters from command line invoke

Thanks for the reply,

 

I had seen the docs before posting, but something was wrong in my test. Here is a working code sample:

 

For a local page:

 

            String url = "TestObjJava?index.html?numero=" + number; 

            ApplicationManager appmanager = ApplicationManager.getApplicationManager();
            appmanager.launchApplication(url);

 

For a remote page:

 

            String url = "TestObjJava?http://remote_server_uri/index.html?numero=" + number;

            ApplicationManager appmanager = ApplicationManager.getApplicationManager();
            appmanager.launchApplication(url);

 

 

I was mistaken application params and URL params. Now the code is working fine.

 

 

Developer
agungeddy
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Widget: read parameters from command line invoke

[ Edited ]

congratulation...

 

But would you please to tell us, inside widget, how to get the params values sent from java like above script??

 

New Contributor
adiaz_caixa
Posts: 5
Registered: ‎12-03-2010
My Device: Not Specified

Re: Widget: read parameters from command line invoke

Hi,

 

Inside the widget the params are in the URL, so I used the method shown here:

 

http://www.netlobo.com/url_query_string_javascript.html

 

 

Developer
agungeddy
Posts: 164
Registered: ‎08-26-2010
My Device: Not Specified

Re: Widget: read parameters from command line invoke

[ Edited ]
Thanks for the URL..