首先需要和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.Smile填坑記——點擊分享出去的網頁,無法跳轉自己的app
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.