2
votes
<?xml version="1.0" encoding="utf-8"?><widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0" rim:header="ipaidabribenaija.com Breaking News and News Updates">
<name>ipaidabribenaija.com</name>
<description>First for Breaking News and News Updates</description>
<content src="index.html" rim:allowInvokeParams="true"/>
<author href="http://www.centurymegasystem.com" rim:copyright="Copyright 2012 wwww.ipaidabribenaija.com" email="[email protected]" xml:lang="en" its:dir="rtl" >Josiah Gerald</author>
<feature id="blackberry.invoke.BrowserArguments" />
<rim:connection timeout="25000">
    <id>TCP_WIFI</id>
    <id>MDS</id>
    <id>BIS-B</id>
    <id>TCP_CELLULAR</id>
    <id>WAP2</id>
    <id>WAP</id>
    </rim:connection>
<license>Copyright (c) 2012 ipaidabribenaija.com.</license>
<icon src="images/icon.png" /></widget>

<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Breaking News and News Updates</title>
<script type="text/javascript">
    var args = new blackberry.invoke.BrowserArguments('http://www.ipaidabribenaija.com');
    blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);
    /*function openWebLinkInBrowser() {
    // open web link in browser
        blackberry.invoke.invoke({target: "sys.browser",uri: "http://www.ipaidabribenaija.com"});
    }
    openWebLinkInBrowser();*/
</script>

I am a newbie in this programming. I am given a task to develop an app for BlackBerry.

Once the app is launched, the browser will open to a specific URL.

I got a java code that does this. How can I achieve the same with BlackBerry Webwork API. The code above is what I have achieve so far. However, the app is not launching the browser on load.

Thanks for your time and idea in advance.

<?xml version="1.0" encoding="utf-8"?><widget xmlns="http://www.w3.org/ns/widgets" xmlns:rim="http://www.blackberry.com/ns/widgets" version="1.0.0" rim:header="ipaidabribenaija.com Breaking News and News Updates">
<name>ipaidabribenaija.com</name>
<description>First for Breaking News and News Updates</description>
<content src="index.html" rim:allowInvokeParams="true"/>
<author href="http://www.centurymegasystem.com" rim:copyright="Copyright 2012 wwww.ipaidabribenaija.com" email="[email protected]" xml:lang="en" its:dir="rtl" >Josiah Gerald</author>
<feature id="blackberry.invoke.BrowserArguments" />
<feature id="blackberry.identity" />
<feature id="blackberry.invoke" />
<rim:connection timeout="25000">
    <id>TCP_WIFI</id>
    <id>MDS</id>
    <id>BIS-B</id>
    <id>TCP_CELLULAR</id>
    <id>WAP2</id>
    <id>WAP</id>
    </rim:connection>
<license>(c) 2012 ipaidabribenaija.com.</license>
<icon src="images/icon.png" /></widget>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Breaking News and News Updates</title>
<script type="text/javascript">
    var args = new blackberry.invoke.BrowserArguments('http://www.ipaidabribenaija.com');
    blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);
    blackberry.app.exit();
</script>

The above code works fine, i tested it on BB simulator 9930. Thanks for the help @HelpMeToHelpYou.

1
Does your current code not work, or are you looking for someone to do the rest of this for you? - Bojangles

1 Answers

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

You must declare the feature element(s) below in your configuration document:according to following image enter image description here

More information please visit

https://developer.blackberry.com/html5/apis/blackberry.invoke.browserarguments.html

Sample Code: Please make sure that config files as following

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
   xmlns:rim="http://www.blackberry.com/ns/widgets"
   version="1.0" rim:header="WebWorks Sample">
  <feature id="blackberry.invoke" />
  <feature id="blackberry.invoke.BrowserArguments" />
   <feature id="blackberry.identity" />
   <name>Hello World</name>
   <description>This is HelloWorld.</description>
   <content src="index.html"/>

</widget>

And index.html as

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, 
            initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, 
            user-scalable=no">
        <title>Hello World</title>
        <script type="text/javascript">
        function myFunction()
        {
              var args = new blackberry.invoke.BrowserArguments('http://www.blackberry.com');
   blackberry.invoke.invoke(blackberry.invoke.APP_BROWSER, args);
        }

</script>
    </head>
    <body onload="myFunction()">
        <p>Hello World!</p>
    </body>
</html>

try this