使用ACTION_CAPTIVE_PORTAL_SIGN_IN [英] Using ACTION_CAPTIVE_PORTAL_SIGN_IN

查看:240
本文介绍了使用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>

这是可能发生的事情:

  1. 设备连接到专属Wi-Fi门户
  2. 系统显示强制性门户通知
  3. 用户触摸通知
  4. 系统显示隐式意图应用选择器
  5. 用户选择SignInActivity
  6. SignInActivity已启动
  1. Device connects to captive Wi-Fi portal
  2. System displays a captive portal notification
  3. User touches the notification
  4. System displays the implicit intent app chooser
  5. User selects SignInActivity
  6. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆