使用ACTION_CAPTIVE_PORTAL_SIGN_IN [英] Using ACTION_CAPTIVE_PORTAL_SIGN_IN
问题描述
Android M支持新的 ACTION_CAPTIVE_PORTAL_SIGN_IN .是否有关于如何捕获此动作的示例.我尝试了通过活动和广播接收器注册动作的常规方法.但是,当我与强制门户无线网络连接时,我没有收到任何操作.有人请帮助
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
推荐答案
它可用于允许您的应用执行强制门户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>
这是可能发生的事情:
- 设备连接到专属Wi-Fi门户
- 系统显示强制性门户通知
- 用户触摸通知
- 系统显示隐式意图应用选择器
- 用户选择
SignInActivity
-
SignInActivity
已启动
- 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
您可以访问 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.
这篇关于使用ACTION_CAPTIVE_PORTAL_SIGN_IN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!