It does work from a link, but does not work if browsed to the URL through the browser.
Intent filter to open my application when a specific URL is called is not working
-
13-10-2022 - |
题
I am trying to use an intent filter to open my activity if a certain URL is opened, whether from a scanned QR code, a link in an email or from browsing to the site from Chrome or the browser. Here is a snippet from my Manifest:
<activity android:name="com.openapp.projecttest.Main" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.qwert.com" android:scheme="http"></data>
</intent-filter>
</activity>
When I browse to it on Google Chrome, it does not seem to trigger the intent filter. Am I missing a permission?
解决方案
其他提示
It should work through a browser link if you include the pathPattern in your data filter.
android:pathPattern="/path/pattern"
where you fill in the path and pattern, of course.
不隶属于 StackOverflow