三星手机会忽略Captive Portal意图(android.net.conn.CAPTIVE_PORTAL)

Pau*_*ber 6 android intentfilter samsung-mobile captivenetwork captiveportal

我想设置一个活动,可以选择该活动来导航俘虏门户。

当我选择一个专属的WiFi网络时,我希望能够选择我的应用程序作为处理程序,而不是启动每台Android手机上预装的CaptivePortalLogin应用程序。

这适用于Pixel 2和OnePlus 6t,但不适用于我在此处放置的任何三星手机(S10(9.0.0),S8(8.0.0),A6(8.0.0))。在三星手机上,它立即打开CaptivePortalLogin应用程序。

CaptivePortalLogin应用程序未在三星手机上设置为默认应用程序。

我以标准方式设置了活动:

<activity android:name=".MainActivity">
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>

        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
    <intent-filter>
        <action android:name="android.net.conn.CAPTIVE_PORTAL"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

有没有办法使三星手机的行为与其他所有手机的行为相同?

小智 0

三星使用 Android 强制门户机制,将门户重定向到其系统,在内部处理它并阻止其他强制门户请求并显示在自己的浏览器上。与三星一样,华为等其他一些供应商也使用自己的机制,只有一加、小米、Htc 等一些供应商使用默认机制,因此可以使用门户意图过滤器重定向到应用程序,但不能重定向到其他应用程序。

<intent-filter>
  <action android:name="android.net.conn.CAPTIVE_PORTAL"/>
  <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
Run Code Online (Sandbox Code Playgroud)

这里有一个链接清楚地解释了这一点:

https://community.arubanetworks.com/t5/Wireless-Access/Samsung-Captive-Portal-Detection/mp/405934#M78972