Can anyone suggest how to open captive portal inside android app?
i have gone through below links https://developer.android.com/reference/android/net/CaptivePortal.html Using ACTION_CAPTIVE_PORTAL_SIGN_IN
Can anyone have a complete guide to use captive portal inside android application?
The captive portal feature is a software implementation that blocks clients from accessing the network until user verification has been established. You can set up verification to allow access for both guests and authenticated users.
Captive portal login is what public Wi-Fi routers use to grant access. When you connect to a public Wi-Fi and it redirects you to a screen asking you to agree to the terms of use, that is the captive portal login in action. Welcome to Android Central!
Following is flow of pushing captive portals
Use following android doc for programming part
https://developer.android.com/reference/android/net/CaptivePortal.html
Think this will useful
WifiPortalAutoLog is an example project that you can use
As describe in this answer: Here is an example scenario:
In MainActivity You may access the extras mentioned in the ConnectionManager.ACTION_CAPTIVE_PORTAL_SIGN_IN
:
if (ConnectivityManager.ACTION_CAPTIVE_PORTAL_SIGN_IN.equals(intent.getAction())) {
get captivePortal
from bundle to communicate with the system about the outcome of the sign in:
captivePortal = intent.getParcelableExtra(ConnectivityManager.EXTRA_CAPTIVE_PORTAL);
Use the ConnectivityManager.EXTRA_NETWORK extra (which has type Network) to communicate with the portal (i.e. pass sign in tokens):
net = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK);
Load url in WebView
and also remember set intent filter in manifest:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.net.conn.CAPTIVE_PORTAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With