【问题标题】:Differences between WifiConfiguration statusWifiConfiguration 状态的区别
【发布时间】:2014-04-01 20:05:08
【问题描述】:

WifiConfiguration.Status = CURRENT 和 ENABLED 有什么区别?我可以理解为 DISABLED,但 CURRENT 和 ENABLED 之间的区别对我来说并不明显。

另外,对于给定的连接网络,4.0.3 不会像 4.0.4 和 4.2.2 一样给我保存状态。前者给我启用,而后者给我电流。有人知道为什么吗?

谢谢!

【问题讨论】:

    标签: android android-4.0-ice-cream-sandwich android-wifi android-4.2-jelly-bean wifi


    【解决方案1】:

    来自 Status 类的 Javadoc:

    /** this is the network we are currently connected to */
    public static final int CURRENT = 0;
    
    /** supplicant will not attempt to use this network */
    public static final int DISABLED = 1;
    
    /** supplicant will consider this network available for association */
    public static final int ENABLED = 2;
    

    因此,如果 4.0.3 没有为当前连接的网络返回 CURRENT,这似乎是 4.0.4 中修复的错误。

    【讨论】:

    • 您知道如何在应用程序中绕过此错误吗?如果我可以检测到应该为当前的正确网络,我可以强制将该值设置为当前吗?我的观点是,像 ServerSocket.accept() 这样的其他 API 方法将在 4.0.3 中失败,我怀疑这可能是导致此失败的错误。
    • 我不确定这实际上是操作系统错误,但如果是这样,您也许可以手动更新状态并保存配置。不过,我不确定过去的任何事情。
    猜你喜欢
    • 2016-04-03
    • 2021-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-30
    • 1970-01-01
    相关资源
    最近更新 更多