The Android M supports a new ACTION_CAPTIVE_PORTAL_SIGN_IN. Is there any sample available on how to capture this action. I tried with the normal way of registering for an action in both through the activity and through the broadcast receiver. However when I am connected with the captive portal wifi network, I am not receiving the actions. Someone please help
Asked
Active
Viewed 3,051 times
1 Answers
8
It can be used to allow your app to perform captive portal Wi-Fi sign in. Assuming you have something like this in your manifest:
<activity android:name=".SignInActivity">
<intent-filter>
<action android:name="android.net.conn.CAPTIVE_PORTAL"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
Here is what can happen:
- Device connects to captive Wi-Fi portal
- System displays a captive portal notification
- User touches the notification
- System displays the implicit intent app chooser
- User selects
SignInActivity
SignInActivity
is launched
You may access the extras mentioned in the ConnectionManager.ACTION_CAPTIVE_PORTAL_SIGN_IN
using getIntent()
and getParcelableExtra()
. Use the ConnectivityManager.EXTRA_NETWORK
extra (which has type Network
) to communicate with the portal (i.e. pass sign in tokens), and the ConnectivityManager.EXTRA_CAPTIVE_PORTAL
extra (which has type CaptivePortal
) to communicate with the system about the outcome of the sign in.
![](../../users/profiles/3168630.webp)
cuihtlauac
- 1,690
- 2
- 16
- 37
-
2I have that setup in the manifest, but always the default sign in page is launched, there is no activity chooser, I also made sure that there is no default app that handles the action – El Jazouli Jul 05 '18 at 09:53
-
Which version of Android are you using? What device? – cuihtlauac Jul 05 '18 at 09:54
-
it's a galaxy J5 with 7.1.1 (25) – El Jazouli Jul 05 '18 at 10:06