HTML5打开本地app应用的方法

2019-01-28 22:08:54王冬梅

本文为大家分享了HTML5打开本地app应用的方法,具体内容如下

首先为了保证能够打开你的app,你必须要在androidManifest.xml中配置的filter中data的属性表述。<data android:pathprefix="/taoge/open" android:scheme="xttblog"></data> androidManifest.xml代码如下:

XML/HTML Code复制内容到剪贴板
  1. <?xml version="1.0" encoding="utf-8"?>   <manifest xmlns:android="http://schemas.android.com/apk/res/android"  
  2.     package="com.taoge"       android:versionCode="2"  
  3.     android:versionName="3.24.03" >       <uses-sdk  
  4.         android:minSdkVersion="8"           android:targetSdkVersion="17" />  
  5.     <application           android:allowBackup="true"  
  6.         android:configChanges="orientation|screenSize"           android:icon="@drawable/logo"  
  7.         android:label="@string/app_name"           android:logo="@drawable/logo"  
  8.         android:sharedUserId="android.uid.system"           android:theme="@android:style/Theme.Light.NoTitleBar" >  
  9.         <activity               android:name="xttblog.WelcomeActivity"  
  10.             android:excludeFromRecents="true"               android:screenOrientation="portrait"  
  11.             android:theme="@android:style/Theme.Light.NoTitleBar" >               <intent-filter>  
  12.                 <action android:name="android.intent.action.MAIN" />                   <category android:name="android.intent.category.LAUNCHER" />  
  13.             </intent-filter>               <intent-filter>  
  14.                 <action android:name="android.intent.action.VIEW" />                   <category android:name="android.intent.category.BROWSABLE" />  
  15.                 <category android:name="android.intent.category.DEFAULT" />                   <data android:pathPrefix="/taoge/open"  
  16.                     android:scheme="xttblog" />               </intent-filter>  
  17.         </activity>           <activity  
  18.             android:name="xttblog.AntRepairActivity"               android:label="@string/title_activity_ant_repair" >  
  19.         </activity>       </application>  
  20. </manifest>