启动其他App指定页面

Posted by アライさん on 2019年10月22日

被启动的页面:

1
2
3
4
5
6
7
8
9
10
11
<activity android:name=".wifi.WifiActivity">
<intent-filter>
<data
android:host="zhibankeji.com"
android:scheme="wifi"
/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
1
2
3
4
5
6
try {
String name = uri.getQueryParameter("name");
String id = uri.getQueryParameter("id");
LogUtils.d(TAG, "name=" + name);
LogUtils.d(TAG, "id=" + id);
}catch (Exception e){}

启动代码:

1
2
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("wifi://zhibankeji.com?name=你好&id=1234"))
startActivity(intent)