<data
android:pathprefix="/taoge/open" android:scheme="xttblog"></data>
androidManifest.xml
代码如下:
XML/HTML Code
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.taoge"
android:versionCode="2"
android:versionName="3.24.03" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:configChanges="orientation|screenSize"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:logo="@drawable/logo"
android:sharedUserId="android.uid.system"
android:theme="@android:style/Theme.Light.NoTitleBar" >
<activity
android:name="xttblog.WelcomeActivity"
android:excludeFromRecents="true"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:pathPrefix="/taoge/open"
android:scheme="xttblog" />
</intent-filter>
</activity>
<activity
android:name="xttblog.AntRepairActivity"
android:label="@string/title_activity_ant_repair" >
</activity>
</application>
</manifest>
其次,你要在你的网页中访问xttblog://taoge/open。可以使用的元素有很多,如:script,iframe,img等。使用它们的src属性,访问xttblog://taoge/open。html5代码如下:
XML/HTML Code复制内容到剪贴板
<!DOCTYPE HTML>
<html>
<script>
function openapp(){
document.getElementById('xttblog').innerHTML='<iframe src="xttblog://taoge/open"></iframe>'
}
</script>
<body>
<div style="display:none" id="xttblog"></div>
<input type="button" value="打开app" onclick="openapp()">
</body>
</html>
HBuilderX
对于HTML5+应用的页面有一个很重要的“plusready”事件,此事件会在页面加载后自动触发,表示所有HTML5+ API可以使用,在此事件触发之前不能调用HTML5+ API,所以应该在此事件回调函数中调用页面初始化需要调用的HTML5+ API,而不应该在onload或DOMContentLoaded事件中调用
Device模块管理设备信息,用于获取手机设备的相关信息,如IMEI、IMSI、型号、厂商等。通过plus.device获取设备信息管理对象。
常用属性
networkinfo是一个对象
Runtime模块管理运行环境,可用于获取当前运行环境信息、与其它程序进行通讯等。通过plus.runtime可获取运行环境管理对象。
常用方法
Camera模块管理设备的摄像头,可用于拍照、摄像 *** 作,通过plus.camera获取摄像头管理对象。
拍照
Gallery模块管理系统相册,支持从相册中选择图片或视频文件、保存图片或视频文件到相册等功能。通过plus.gallery获取相册管理对象。
常用方法
nativeUI管理系统原生界面,可用于d出系统原生提示对话框窗口、时间日期选择对话框、等待对话框等。
常用方法
Webview模块管理应用窗口界面,实现多窗口的逻辑控制管理 *** 作。通过plus.webview可获取应用界面管理对象。
常用方法
完整API详情请查看 官方API文档
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)