要想在浏览器启动APP的方法例如以下:
在须要跳转的ACTIVITY中加入intent-filter的相关信息:
<intent-filter>
<data android:scheme="com.example.scheme" />
</intent-filter>
实比例如以下:
<activity android:name=".BrowActivity" >
<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="com.example.scheme" />
</intent-filter>
</activity>
然后再HTML加入例如以下链接就可以:<a href="my.special.scheme://other/parameters/here">
进入APP之后,能够使用getIntent()来获取URL携带的相关信息:
EG:http://twitter.com/status/1234
Uri data = getIntent().getData();
String scheme = data.getScheme(); // "http"
String host = data.getHost(); // "twitter.com"
List<String> params = data.getPathSegments();
String first = params.get(0); // "status"
String second = params.get(1); // "1234"