Android支持通过Url打开App,比如下面的Url
scheme://text/datastring
要打开这样的Url,首先在配置文件AndroidManifest.xml里使用添加一种App打开的格式,代码如下
<?xml version="1.0″ encoding="utf-8″?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.demo"
android:versionCode="1″
android:versionName="1.0″ >
<uses-sdk
android:minSdkVersion="9″
android:targetSdkVersion="17″ />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.sheng00.customuridemo.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!– Open links like scheme://test/?… –>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="scheme” android:host="test" />
</intent-filter>
</activity>
</application
</manifest>
scheme可是是你定义的别的字符串,android:host可以不写,这样就只能是通过android:scheme进度过滤定位
比如 test://xxxxx android:scheme=”test”这样也可以启动你的程序