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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
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
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
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
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
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

 

 

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

Re: Widget: read parameters from command line invoke

[ Edited ]
Thanks for the URL..