2
<?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="josiahaccounts@gmail.com" 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>

我是这个编程的新手。我的任务是为 BlackBerry 开发应用程序。

启动应用程序后,浏览器将打开特定的 URL。

我有一个执行此操作的 java 代码。如何使用 BlackBerry Webwork API 实现相同的功能。上面的代码是我到目前为止所实现的。但是,该应用程序不会在加载时启动浏览器。

提前感谢您的时间和想法。

<?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="josiahaccounts@gmail.com" 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>

上面的代码运行良好,我在 BB 模拟器 9930 上对其进行了测试。感谢@HelpMeToHelpYou 的帮助。

4

1 回答 1

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

您必须在配置文档中声明以下功能元素:根据下图在此处输入图像描述

更多信息请访问

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

示例代码:请确保配置文件如下

<?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>

和 index.html 作为

<!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>

试试这个

于 2012-12-05T12:19:30.280 回答