7

I want to setup an Activity that can be chosen to navigate a captive portal.

When I select a WiFi network that is captive I want to be able to choose my app as the handler instead of starting the CaptivePortalLogin app that's preinstalled on every Android phone.

This works on a Pixel 2 and on a OnePlus 6t but it doesn't on any of the Samsung phones I have laying around here (S10 (9.0.0), S8 (8.0.0), A6 (8.0.0)). On the Samsung phones it instantly opens the CaptivePortalLogin app.

The CaptivePortalLogin app is not set as a default app on the Samsung phones.

I have setup the activity in the standard way:

<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>

Is there a way to make Samsung phones behave the way all other phones behave?

Paul Weber
  • 133
  • 9
  • 1
    AFAIK captive portal works differently for samsung's android. They don't work via 302 redirect which then uses user intent, but by accessing /generate_204. As such, they need not rely on captive portal intent. – RKalra Apr 10 '19 at 12:40

1 Answers1

0

Samsung uses the android captive portal mechanism by redirecting portal to their system, handles it internally and blocks other captive portal requests and shows on its own browser. Like Samsung, some other vendors like Huawei and more too use their own mechanism and only some including Oneplus, Mi, Htc and others use default mechanism and hence can be redirected to the app using the portal intent filter but not for else.

<intent-filter>
  <action android:name="android.net.conn.CAPTIVE_PORTAL"/>
  <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

One link explaining it clearly is here:

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