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

Java Development

Reply
Visitor
okanime
Posts: 1
Registered: ‎11-12-2010
My Device: Bold 9700
My Carrier: Vodacom

Newbie: How to invoke default BlackBerry Browser and load a url as the browser loads

[ Edited ]

Hi Guys,

 

I working on my first widget using Eclipse. It's really not a complicated widget. What I want to do is when the widget loads to open the default BB browser and load a weblink immediately. Once the browser loads the widget should die.

 

Can anyone help me out?

 

Thanks.

Please use plain text.
Developer
JCarty
Posts: 1,055
Registered: ‎01-25-2009
My Device: BlackBerry Bold 9650/BlackBerry Torch 9800

Re: Newbie: How to invoke default BlackBerry Browser and load a url as the browser loads

[ Edited ]

1) The Web Development forum is a better place to post:

 

2) Here is your code:

 

 

<script type="text/javascript">
var args = new blackberry.invoke.BrowserArguments('http://www.yoursite.com');
blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);
blackberry.app.exit();
</script>

 

 

Jerome Carty - Follow jcarty on Twitter@jcarty | #webworks-dev / #BlackberryDev on irc.freenode.net | My Apps
Click "Accept as Solution" if post solved your original issue.. Give like/thumbs up if you feel post is helpful
Please use plain text.
New Contributor
giovanni_pannaconi
Posts: 4
Registered: ‎05-16-2011
My Device: Blackberry Bold 9700
My Carrier: Telecom Italia Mobile

Re: Newbie: How to invoke default BlackBerry Browser and load a url as the browser loads

Dear Jerome,

 

I have tried your solution but on my BOLD 9700 the result is that the browser remain in background, if I remove

the blackberry.app.exit(); line the browser remains visibile but on back the screen of my widget appear.

 

How can I launch the browser and die my widget while leaving the browser in foreground?

May I register the callback for the onForeground event after invoking the browser in order to close the widget as soon as it comes back visible?

 

Thank You

 

Please use plain text.
Developer
peter_strange
Posts: 19,603
Registered: ‎07-14-2008
My Device: Not Specified

Re: Newbie: How to invoke default BlackBerry Browser and load a url as the browser loads

I am a little confused by this requirement, so to clarify.

 

All you want is to have an icon on the Blackberry.  When the icon is pressed, a Web page is loaded in the standard Browser, then your application dies?

 

If that is correct, then you can write a very small java application, in it you will just start the Browser using this KB article.

http://supportforums.blackberry.com/t5/Java-Development/Invoke-the-browser/ta-p/445362

 

Take you application to the background

<application>.(requestBackground();

 

Then start a Thread, that stalls for 5 seconds, and then issues a System.exit().

 

Job done I think. 

 

 

Please use plain text.
New Developer
hobby_johals
Posts: 120
Registered: ‎05-20-2011
My Device: Touch 9800
My Carrier: Vodafone

Re: Newbie: How to invoke default BlackBerry Browser and load a url as the browser loads

Try this

 

BrowserFieldConfig myBrowserFieldConfig = new BrowserFieldConfig();
myBrowserFieldConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE, BrowserFieldConfig.NAVIGATION_MODE_POINTER);
BrowserField browserField = new BrowserField(myBrowserFieldConfig);
browserField.requestContent("your URL");

 

Amar
Please use plain text.