123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <meta name="HandheldFriendly" content="true">
- <meta name="MobileOptimized" content="320">
- <title>Runtime Document</title>
- <link rel="stylesheet" type="text/css" href="res/doc.css" charset="utf-8">
- <link rel="stylesheet" type="text/css" href="res/prettify.sons.css" charset="utf-8">
- <script type="text/javascript" src="res/doc.js" charset="utf-8"></script><script type="text/javascript" src="res/prettify.js" charset="utf-8"></script>
- </head>
- <body><div id="content" class="content">
- <h1><a name="plus.runtime">runtime</a></h1>
- <p>Runtime模块管理运行环境,可用于获取当前运行环境信息、与其它程序进行通讯等。通过plus.runtime可获取运行环境管理对象。</p>
- <h2>属性:</h2>
- <ul>
- <li>
- <a href="#plus.runtime.appid">appid</a>: 当前应用的APPID</li>
- <li>
- <a href="#plus.runtime.arguments">arguments</a>: 第三方程序调用时传递给程序的参数</li>
- <li>
- <a href="#plus.runtime.channel">channel</a>: 应用的渠道标识</li>
- <li>
- <a href="#plus.runtime.launcher">launcher</a>: 应用启动来源</li>
- <li>
- <a href="#plus.runtime.origin">origin</a>: 应用安装来源</li>
- <li>
- <a href="#plus.runtime.version">version</a>: 客户端的版本名称</li>
- <li>
- <a href="#plus.runtime.versionCode">versionCode</a>: 客户端的版本号</li>
- <li>
- <a href="#plus.runtime.innerVersion">innerVersion</a>: 客户端5+运行环境的内部版本号</li>
- <li>
- <a href="#plus.runtime.uniVersion">uniVersion</a>: 客户端uni-app运行环境的版本号</li>
- <li>
- <a href="#plus.runtime.launchLoadedTime">launchLoadedTime</a>: 获取当前应用首页加载的时间</li>
- <li>
- <a href="#plus.runtime.processId">processId</a>: 获取当前应用的进程标识</li>
- <li>
- <a href="#plus.runtime.startupTime">startupTime</a>: 获取当前应用的启动时间戳</li>
- <li>
- <a href="#plus.runtime.isRecovery">isRecovery</a>: 应用是否由于内核崩溃自动恢复</li>
- </ul>
- <h2>方法:</h2>
- <ul>
- <li>
- <a href="#plus.runtime.getProperty">getProperty</a>: 获取指定APPID对应的应用信息</li>
- <li>
- <a href="#plus.runtime.install">install</a>: 安装应用</li>
- <li>
- <a href="#plus.runtime.quit">quit</a>: 退出应用</li>
- <li>
- <a href="#plus.runtime.restart">restart</a>: 重启当前的应用</li>
- <li>
- <a href="#plus.runtime.setBadgeNumber">setBadgeNumber</a>: 设置程序快捷方式图标上显示的角标数字</li>
- <li>
- <a href="#plus.runtime.openURL">openURL</a>: 调用第三方程序打开指定的URL</li>
- <li>
- <a href="#plus.runtime.openWeb">openWeb</a>: 使用内置Webview窗口打开URL</li>
- <li>
- <a href="#plus.runtime.openFile">openFile</a>: 调用第三方程序打开指定的文件</li>
- <li>
- <a href="#plus.runtime.processDirectPage">processDirectPage</a>: 处理直达页面链接参数</li>
- <li>
- <a href="#plus.runtime.launchApplication">launchApplication</a>: 调用第三方程序</li>
- <li>
- <a href="#plus.runtime.isApplicationExist">isApplicationExist</a>: 判断第三方程序是否已存在</li>
- <li>
- <a href="#plus.runtime.isCustomLaunchPath">isCustomLaunchPath</a>: 判断是否自定义应用启动页面加载地址</li>
- </ul>
- <h2>对象:</h2>
- <ul>
- <li>
- <a href="#plus.runtime.ApplicationInf">ApplicationInf</a>: JSON对象,打开第三方程序参数</li>
- <li>
- <a href="#plus.runtime.BadgeOptions">BadgeOptions</a>: JSON对象,应用角标显示需要的通知栏消息的参数</li>
- <li>
- <a href="#plus.runtime.OpenFileOptions">OpenFileOptions</a>: JSON对象,打开文件参数</li>
- <li>
- <a href="#plus.runtime.WidgetInfo">WidgetInfo</a>: JSON对象,应用信息</li>
- <li>
- <a href="#plus.runtime.WidgetOptions">WidgetOptions</a>: JSON对象,应用安装参数</li>
- </ul>
- <h2>回调方法:</h2>
- <ul>
- <li>
- <a href="#plus.runtime.InstallSuccessCallback">InstallSuccessCallback</a>: 安装应用成功回调函数</li>
- <li>
- <a href="#plus.runtime.InstallErrorCallback">InstallErrorCallback</a>: 安装应用失败回调函数</li>
- <li>
- <a href="#plus.runtime.GetPropertyCallBack">GetPropertyCallBack</a>: 获取应用属性成功回调函数</li>
- <li>
- <a href="#plus.runtime.OpenErrorCallback">OpenErrorCallback</a>: 打开本地文件或URL失败回调函数</li>
- <li>
- <a href="#plus.runtime.LaunchErrorCallback">LaunchErrorCallback</a>: 调用第三方程序失败回调函数</li>
- </ul>
- <h2>权限:</h2>
- <p>5+功能模块(permissions)</p>
- <pre class="prettyprint linenums">
- {
- // ...
- "permissions":{
- // ...
- "Runtime": {
- "description": "运行环境"
- }
- }
- }
- </pre>
- <h1><a name="plus.runtime.ApplicationInf">ApplicationInf</a></h1>
- <p>JSON对象,打开第三方程序参数</p>
- <h2>属性:</h2>
- <ul>
- <li>pname: <em>(<font class="type">String</font>
- 类型
- )</em>第三方程序包名<br><p>仅Android平台支持,表示程序的包名,其它平台忽略此属性值。</p>
- </li>
- <li>action: <em>(<font class="type">String</font>
- 类型
- )</em>程序的操作行为<br><p>Android平台上与系统的action值一致;iOS平台为要调用程序的URLScheme格式字符串。</p>
- </li>
- <li>newTask: <em>(<font class="type">Boolean</font>
- 类型
- )</em>新任务模式标记<br><p>
- 可取值:
- true-使用新任务模式标记(FLAG_ACTIVITY_NEW_TASK)启动应用;
- false-不使用新任务模式标记(FLAG_ACTIVITY_NEW_TASK)启动应用。
- 默认值为true。
- 注意:由于5+应用配置的launchMode为singleTask,所以另一个5+应用通过plus.runtime.launchApplication启动时如果应用已经在后台运行则不会触发newintent事件,为了避免此问题需要将newTask参数值设置为false。
- </p>
- </li>
- <li>extra: <em>(<font class="type">JSON</font>
- 类型
- )</em>调用程序的参数<br><p>仅Android平台支持,为JSON格式,用于传递给要调用程序的参数,如extra:{url:"http://www.html5plus.org"}。</p>
- </li>
- </ul>
- <h1><a name="plus.runtime.BadgeOptions">BadgeOptions</a></h1>
- <p>JSON对象,应用角标显示需要的通知栏消息的参数</p>
- <h2>属性:</h2>
- <ul>
- <li>title: <em>(<font class="type">String</font>
- 类型
- )</em>消息的标题<br><p>
- 默认值为应用的名称。
- </p>
- </li>
- <li>content: <em>(<font class="type">String</font>
- 类型
- )</em>消息的内容<br><p>
- 默认值为“您有x条未读消息"”,其中x未设置的角标数字值。
- </p>
- </li>
- </ul>
- <h1><a name="plus.runtime.OpenFileOptions">OpenFileOptions</a></h1>
- <p>JSON对象,打开文件参数</p>
- <h2>属性:</h2>
- <ul>
- <li>pname: <em>(<font class="type">String</font>
- 类型
- )</em>优先使用的程序包名<br><p>
- 如果指定包名的程序已经安装,则调用其打开文件,若程序不支持打开文件则触发错误回调。
- 如果指定包名的程序未安装,则弹出系统支持打开此文件的列表,由用户选择程序打开。
- </p>
- </li>
- <li>popover: <em>(<font class="type">json</font>
- 类型
- )</em>弹出系统选择程序界面指示区域<br><p>
- JSON对象,格式如{top:10;left:10;width:200;height:200;},所有值为像素值,左上坐标相对于容器webview的位置。仅在iPad设备平台有效。
- </p>
- </li>
- </ul>
- <h1><a name="plus.runtime.WidgetInfo">WidgetInfo</a></h1>
- <p>JSON对象,应用信息</p>
- <h2>属性:</h2>
- <ul>
- <li>appid: <em>(<font class="type">String</font>
- 类型
- )</em>应用的APPID<br><p>
- 对应manifest.json中的id字段值。
- </p>
- </li>
- <li>version: <em>(<font class="type">String</font>
- 类型
- )</em>应用的版本名称<br><p>
- 对应manifest.json中的version->name字段值。
- </p>
- </li>
- <li>versionCode: <em>(<font class="type">String</font>
- 类型
- )</em>应用的版本号<br><p>
- 对应manifest.json中的version->code字段值。
- </p>
- </li>
- <li>name: <em>(<font class="type">String</font>
- 类型
- )</em>应用的名称<br><p>
- 对应manifest.json中的name字段值。
- </p>
- </li>
- <li>description: <em>(<font class="type">String</font>
- 类型
- )</em>应用描述信息<br><p>
- 对应manifest.json中的description字段值。
- </p>
- </li>
- <li>author: <em>(<font class="type">String</font>
- 类型
- )</em>应用描述信息<br><p>
- 对应manifest.json中的developer->name字段值。
- </p>
- </li>
- <li>email: <em>(<font class="type">String</font>
- 类型
- )</em>开发者邮箱地址<br><p>
- 对应manifest.json中的developer->email字段值。
- </p>
- </li>
- <li>features: <em>(<font class="type">String[]</font>
- 类型
- )</em>应用许可特性列表<br><p>
- 对应manifest.json中的permissions字段下所有键名的列表。
- </p>
- </li>
- </ul>
- <h1><a name="plus.runtime.WidgetOptions">WidgetOptions</a></h1>
- <p>JSON对象,应用安装参数</p>
- <h2>说明:</h2>
- <p class="des">可通过对象设置安装的应用是否进行appid校验、版本号校验等。</p>
- <h2>属性:</h2>
- <ul><li>force: <em>(<font class="type">Boolean</font>
- 类型
- )</em>是否强制安装<br><p>
- true表示强制安装,不进行版本号的校验;false则需要版本号校验,如果将要安装应用的版本号不高于现有应用的版本号则终止安装,并返回安装失败。
- 仅安装wgt和wgtu时生效,默认值 false。
- </p>
- </li></ul>
- <h1><a name="plus.runtime.InstallSuccessCallback">InstallSuccessCallback</a></h1>
- <p>安装应用成功回调函数</p>
- <pre class="prettyprint linenums">
- void onSuccess(widgetInfo){
- // Code here
- }
- </pre>
- <h2>参数:</h2>
- <ul><li>widgetInfo:
- <em>(
- <font class="type">WidgetInfo</font>
- )
- 必选 </em><br>应用信息,参见:WidgetInfo</li></ul>
- <h2>返回值:</h2>
- <font class="type">void</font>
- : 无<h1><a name="plus.runtime.InstallErrorCallback">InstallErrorCallback</a></h1>
- <p>安装应用失败回调函数</p>
- <pre class="prettyprint linenums">
- void onError(error){
- // Handle the error
- }
- </pre>
- <h2>参数:</h2>
- <ul><li>error:
- <em>(
- <font class="type">DOMException</font>
- )
- 必选 </em><br>安装失败的错误信息</li></ul>
- <h2>返回值:</h2>
- <font class="type">void</font>
- : 无<h1><a name="plus.runtime.GetPropertyCallBack">GetPropertyCallBack</a></h1>
- <p>获取应用属性成功回调函数</p>
- <pre class="prettyprint linenums">
- void onGetPropertyCB(widgetInfo){
- // Code here
- }
- </pre>
- <h2>参数:</h2>
- <ul><li>widgetInfo:
- <em>(
- <a href="#plus.runtime.WidgetInfo">WidgetInfo</a>
- )
- 必选 </em>应用信息<br>
- 包括应用名称、标识等属性。
- </li></ul>
- <h2>返回值:</h2>
- <font class="type">void</font>
- : 无<h1><a name="plus.runtime.OpenErrorCallback">OpenErrorCallback</a></h1>
- <p>打开本地文件或URL失败回调函数</p>
- <pre class="prettyprint linenums">
- void onError(error){
- // Handle the error
- }
- </pre>
- <h2>参数:</h2>
- <ul><li>error:
- <em>(
- <font class="type">DOMException</font>
- )
- 必选 </em><br>打开操作失败的错误信息</li></ul>
- <h2>返回值:</h2>
- <font class="type">void</font>
- : 无<h1><a name="plus.runtime.LaunchErrorCallback">LaunchErrorCallback</a></h1>
- <p>调用第三方程序失败回调函数</p>
- <pre class="prettyprint linenums">
- void onError(error){
- // Handle the error
- }
- </pre>
- <h2>参数:</h2>
- <ul><li>error:
- <em>(
- <font class="type">DOMException</font>
- )
- 必选 </em>操作失败的错误信息<br>
- 可通过error.code(Number类型)获取错误编码;
- 可通过error.message(String类型)获取错误描述信息。
- </li></ul>
- <h2>返回值:</h2>
- <font class="type">void</font>
- : 无<br><br>
- </div></body>
- </html>
|