Android点击链接跳转到指定APP页面
2017-04-27 本文已影响733人
D___Will
指定APP页面配置
<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:host="www.myapp.com"
android:pathPrefix="/index.html"
android:scheme="http" / >
</intent-filter>
类似于网页< a href="http://www.myapp.com/index.html?data1=123&data2=456">Open Application</a>
在指定APP页面获取网页回调内容
读取数据data时
Intent intent = getIntent();
String action = intent.getAction();
if(Intent.ACTION_VIEW.equals(action)){
Uri uri = intent.getData();
if(uri != null){
String data1 = uri.getQueryParameter("data1");
String data2= uri.getQueryParameter("data2");
android.util.Log.v("data1", data1);
android.util.Log.v("data2", data2);
}
}