【发布时间】:2018-01-04 11:02:10
【问题描述】:
我正在尝试为我的应用配置 deeplinks。我配置了几个选项,例如:
https://myapp.com/news ---> NewsActivity
https://myapp.com/history ---> HistoryActivity
带有意图过滤器,例如:
<intent-filter android:label="MyApp">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="myapp.com"
android:pathPrefix="/news" />
</intent-filter>
和
<intent-filter android:label="MyApp">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="myapp.com"
android:pathPrefix="/history" />
</intent-filter>
我还想要一个从基本域指向我的主要活动的链接
https://myapp.com ---> MainActivity
我希望链接响应基本域,但不响应其他链接,例如:https://myapp.com/playlists,因为播放列表功能当前未在应用中实现,最好重定向到网络。
但是当我设置意图过滤器时:
<intent-filter android:label="MyApp">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="myapp.com"
android:path="" />
</intent-filter>
我收到以下 lint 警告:
android:path 不能为空
确保您的应用支持该 URL,以获取安装和流量 从 GoogleSearch 到您的应用。
尽管有这个警告,但它的行为是正确的。如何解决此警告?
【问题讨论】:
标签: android