请查看下面的两个链接。在Whatsapp中粘贴时,第一个打开Facebook应用程序,第二个打开浏览器。
在Facebook应用中打开:
https://m.facebook.com/SriSwamiji/posts/1099353043449548:0
在浏览器中打开:
是什么使第二个链接在浏览器中打开?我想通过Facebook应用程序打开它。
我想说这是由于深层链接。在您的任何应用中,您都可以添加过滤器,以在Android系统尝试解析URL时触发您的应用。
可能是Facebook应用已配置了http://m.*
网址的深层链接
编辑:我已经通过adb测试了它,这是由于深层链接。你可以用
adb shell am start -W -a android.intent.action.VIEW -d <URL>
这是输出:
$ adb shell am start -W -a android.intent.action.VIEW -d "https://m.facebook.com/SriSwamiji/posts/1099353043449548:0"
Starting: Intent { act=android.intent.action.VIEW dat=https://m.facebook.com/... }
Status: ok
Activity: com.facebook.katana/com.facebook.deeplinking.activity.StoryDeepLinkLoadingActivity
ThisTime: 127
TotalTime: 208
WaitTime: 253
Complete
如您所见,Activity
启动的是com.facebook.katana
(Facebook应用程序)。
$ adb shell am start -W -a android.intent.action.VIEW -d "https://www.facebook.com/SriSwamiji/photos/a.186720728046122.67368.108460819205447/1099353043449548/?type=3"
Starting: Intent { act=android.intent.action.VIEW dat=https://www.facebook.com/... }
Status: ok
Activity: com.android.chrome/org.chromium.chrome.browser.document.DocumentActivity
ThisTime: 121
TotalTime: 179
WaitTime: 223
Complete
在这种情况下com.android.chrome
启动
另外,如果您查看Facebook应用清单(使用ManifestViewer之类的应用,您会发现它intent-filter
可以处理一些问题:
<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="http"
android:host="m.facebook.com"
android:pathPrefix="/events"/>
<data
android:scheme="https"
android:host="m.facebook.com"
android:pathPrefix="/events"/>
<data
android:scheme="http"
android:host="m.facebook.com"
android:pathPrefix="/groups"/>
<data
android:scheme="https"
android:host="m.facebook.com"
android:pathPrefix="/groups"/>
<data
android:scheme="http"
android:host="www.facebook.com"
android:pathPrefix="/groups"/>
<data
android:scheme="https"
android:host="www.facebook.com"
android:pathPrefix="/groups"/>
<data
android:scheme="http"
android:host="www.facebook.com"
android:pathPrefix="/events"/>
<data
android:scheme="https"
android:host="www.facebook.com"
android:pathPrefix="/events"/>
</intent-filter>
在您的具体情况下,我会说该链接是在
<activity
android:theme="@2131625627"
android:name="com.facebook.katana.ContactUriHandler"
android:taskAffinity="com.facebook.task.ContactUriHandler"
android:excludeFromRecents="true"
android:launchMode="singleInstance">
<intent-filter>
<action
android:name="android.intent.action.VIEW"/>
<category
android:name="android.intent.category.DEFAULT"/>
<data
android:mimeType="vnd.android.cursor.item/vnd.facebook.profile"
android:host="com.android.contacts"/>
<data
android:mimeType="vnd.android.cursor.item/vnd.facebook.presence"
android:host="com.android.contacts"/>
</intent-filter>
</activity>
并且内部支持帖子,但不支持照片
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句