[英]Intent filter works from Google+, but not Chrome & Facebook
我在Google Play上的應用的 AndroidManifest.xml文件中有以下內容:
<activity
android:name="com.enigmadream.picturecode.Viewer"
android:exported="true"
android:label="@string/title_activity_viewer"
android:parentActivityName="com.enigmadream.picturecode.Editor" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.enigmadream.picturecode.Editor" />
<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="picturecode.enigmadream.com"
android:scheme="http" />
</intent-filter>
</activity>
而且我覺得它工作正常。 如果您點擊Google+上的鏈接,它似乎仍然可以正常工作 - 當您單擊使用服務器名稱picturecode.enigmadream.com
的鏈接時,它提供了啟動我的應用而不是瀏覽器的選項。 但是當我從Facebook或Chrome中點擊picturecode.enigmadream.com的鏈接時 ,它不提供該選項,而只是導航到Chrome中的頁面。 我錯過了什么?
您需要使用自己的方案(例如picturecode://)。 Facebook和Chrome都可能自己處理http方案,因此不要檢查是否有任何其他活動可以處理它。 這樣做的結果是,對於較短的URI,您可能不需要使用主機。 只是picturecode://01sv...
您當然也可以保留此過濾器。 如果瀏覽器訪問該頁面,只需要一個鏈接到正確的URI,或者甚至只是自動重定向。
作為參考,您可以使用market:// scheme以這種方式查看Google Play。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.