Intent 过滤器匹配 URL
Intent filter matching URL
我已经尝试了数小时以来找到的每个示例,其中包含 android::path、pathPrefix 等的不同组合,但无法使其正常工作。
我的应用程序的 Intent 过滤器应该如何匹配这个 URL 看起来像:"example.com/View/File/xxx" 其中 xxx 是一个随机文件号?
感谢您的帮助!
你在清单中试过这个吗:
<activity android:name=".YourActivity">
<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:scheme="http" android:host="www.example.com" android:path="/View/File/" android:pathPattern=".*"></data>
</intent-filter>
然后在你的代码中:
String data = getIntent().getDataString();
摘自 here and the Android Manifest Docs。我没有机会对此进行测试,如果它不起作用,请尝试弄乱路径、parthPrefix 和 pathPattern。
我已经尝试了数小时以来找到的每个示例,其中包含 android::path、pathPrefix 等的不同组合,但无法使其正常工作。
我的应用程序的 Intent 过滤器应该如何匹配这个 URL 看起来像:"example.com/View/File/xxx" 其中 xxx 是一个随机文件号?
感谢您的帮助!
你在清单中试过这个吗:
<activity android:name=".YourActivity">
<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:scheme="http" android:host="www.example.com" android:path="/View/File/" android:pathPattern=".*"></data>
</intent-filter>
然后在你的代码中:
String data = getIntent().getDataString();
摘自 here and the Android Manifest Docs。我没有机会对此进行测试,如果它不起作用,请尝试弄乱路径、parthPrefix 和 pathPattern。