更新时间:2023-12-04 16:13:52
它可用于允许您的应用执行强制门户Wi-Fi登录.假设清单中包含以下内容:
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>
这是可能发生的事情:
SignInActivity
SignInActivity
已启动SignInActivity
SignInActivity
is launched您可以访问 ConnectionManager.ACTION_CAPTIVE_PORTAL_SIGN_IN
中提到的其他功能>使用 getIntent()
和 ConnectivityManager.EXTRA_NETWORK
(类型为 Network
)与门户网站( ie )通信通过登录令牌),以及 ConnectivityManager.EXTRA_CAPTIVE_PORTAL
额外的(类型为 CaptivePortal
)以与系统就结果进行通信登录的位置.
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.