【发布时间】:2015-12-30 14:03:32
【问题描述】:
我想从浏览器重定向到我的应用程序,因此我在 Manifest 中为我的 Activity 使用以下代码:
<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="fivos"
android:host="book"
/>
</intent-filter>
// 接受以“fivos://book”开头的 URI
浏览器发送的 Uri 中还有一些参数(例如 fivos://book?username=george)。 在我被重定向到的 Activity 中,我使用以下代码获取 Uri 但参数似乎不存在于 Uridata 对象中,除了方案和主机
Uri URIdata = getIntent().getData();
if(URIdata != null){
String scheme = URIdata.getScheme();
String host = URIdata.getHost();
List params = URIdata.getPathSegments();
String username = params.get(0).toString();
}
我的清单中是否缺少某些内容?
【问题讨论】:
标签: android parameters uri intentfilter deep-linking