首先需要和web端的开发制定规则,也就是安卓中的 scheme
test://xxx?params=
scheme://host:port/path
一般host:port就是IP,端口号,正式的或者直接用域名就OK
scheme 这个就是我遇到的坑,必须小写,必须小写,必须小写,重要的话说3遍
pathPattern 就是后面匹配的东西
在manifest中配置
<activity android:name=".webapi.WebEntityActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="xxxx" android:scheme="test" />
</intent-filter>
</activity>
在WebEntityActivity中
Uri data = getIntent().getData();
String params = data.getQueryParameter("params");
params就是web端 返回给我们的数据,就是?后面的数据
再次说明 scheme必须小写,必须小写,必须小写
Mr.Alright---点击分享出去的网页,无法跳转自己的app
最新推荐文章于 2021-02-06 16:14:45 发布