Using ACTION_CAPTIVE_PORTAL_SIGN_IN

Android M supports the new ACTION_CAPTIVE_PORTAL_SIGN_IN . Is there any sampling of how this action can be captured. I tried with the usual registration method for an action both through activity and through a broadcast receiver. However, when I am connected to the wifi network of the portable port, I get no action. Someone please help

+6
source share
1 answer

It can be used to allow your application to perform input input to the portal’s Wi-Fi. Assuming there is 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's what could happen:

  • The device connects to the Wi-Fi portal with fixed access
  • The system displays a portal inaccessibility notification
  • User accesses notification
  • The system displays an implicit application selection method
  • User selects SignInActivity
  • SignInActivity launched

You can access the additional functions specified in ConnectionManager.ACTION_CAPTIVE_PORTAL_SIGN_IN using getIntent() and getParcelableExtra() . Use ConnectivityManager.EXTRA_NETWORK extra (which is of type Network ) to communicate with the portal (i.e. the badge in tokens) and ConnectivityManager.EXTRA_CAPTIVE_PORTAL extra (which is of type CaptivePortal ) to communicate with the system about the results of the sign.

+8
source

All Articles