设置查找变量的意图



我对Android知之甚少,所以如果这个问题问得不好,请原谅。

我正在尝试设置一个在选择 url 时打开我的应用程序的意图......我的代码如下所示:

        <intent-filter> 
            <data android:scheme="http" android:host="something.com" android:pathPattern=".*p=.*" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

它运行良好 - 但我只想在 URL 中有变量"p"时才启动该应用程序。意思是:不要启动 http://something.com/ok 而是启动 http://something.com/ok/?p=100

我想我需要添加android:pathPattern属性并查找"p="? 有人可以帮忙吗?

为此,

您可以使用意图过滤器的pathPattern属性。 (请参阅此处的参考资料。

最新更新