【问题标题】:Android Intent filter for url with redirect带有重定向的 url 的 Android Intent 过滤器
【发布时间】:2017-08-22 13:06:08
【问题描述】:

如何为带有重定向的 url 设置意图过滤器?

https://mail.mailserverXXX.com/m/redirect?url=http://foosubdomain.foodomain.com/#object?id=e1162d22-222b-4522-2210-c222102d6022

此过滤器不适用于上述 URL。

 <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"/>
        <data android:scheme="https"/>
        <data android:host="foosubdomain.foodomain.com"/>
</intent-filter>

此过滤器适用于上述 URL。但这不是所需要的。我需要在重定向部分按主机过滤 foosubdomain.foodomain.com

 <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"/>
        <data android:scheme="https"/>
        <data android:host="mail.mailserverXXX.com"/>
</intent-filter>

【问题讨论】:

    标签: android android-intent intentfilter


    【解决方案1】:

    好吧,坏消息。经过长时间的检查,我发现intent-filter 甚至不解析问号后的所有内容

    换句话说,来自链接

    https://mail.mailserverXXX.com/m/redirect?url=http://foosubdomain.foodomain.com/#object?id=e1162d22-222b-4522-2210-c222102d6022

    Intent-filter 仅适用于该部分

    https://mail.mailserverXXX.com/m/redirect

    因此不可能为您的问题编写通用解决方案。

    【讨论】:

    • 它不起作用,或者我在某个地方错了。我也不需要在过滤器中提及特定的邮件服务器。
    • DEADMC,感谢您的帮助。不幸的是,邮件服务器添加了对 URL 的重定向。
    • @pier_nasos 但点击重定向链接后,您将打开您的网站,对吗?您可以在您的网址中再添加一个参数,例如 mobileRedirect=true,然后强制从网站打开移动应用。
    • 该站点也在那里,它执行与移动应用程序相同的任务。好的方法是,单击链接时,我需要打开应用程序(如果已安装),否则-打开站点。但网站无法确定应用程序是否已安装。
    • @pier_nasos 其实网站可以=)检查stackoverflow.com/questions/6888867/…
    猜你喜欢
    • 2011-04-14
    • 2014-08-12
    • 1970-01-01
    • 2013-09-02
    • 2013-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-28
    相关资源
    最近更新 更多