当 Wifi 连接恢复时,仅具有带有操作 NETWORK_STATE_CHANGED_ACTION
的广播 Intent (其常量值为 android.net.wifi.STATE_CHANGE
)是否正常? IE。当 Wifi 断开连接时,我没有得到这个 Intent 。
更新:我最感兴趣的是 >= 2.2 Froyo
最佳答案
public static final String SUPPLICANT_CONNECTION_CHANGE_ACTION
Since: API Level 1
Broadcast intent action indicating that a connection to the supplicant has been established (and it is now possible to perform Wi-Fi operations) or the connection to the supplicant has been lost. One extra provides the connection state as a boolean, where true means CONNECTED.
See Also
EXTRA_SUPPLICANT_CONNECTED
Constant Value: "android.net.wifi.supplicant.CONNECTION_CHANGE"
在 android 的 API 中,它说检查网络连接的 STATE_CHANGE 不是一个好主意,您应该使用 SUPPLICANT_CONNECTION_CHANGE_ACTION。这将通知 wifi 网络的建立,以及 wifi 网络的断开。我不知道这是否对你有帮助,但我希望如此。 LINK
关于android.net.wifi.STATE_CHANGE : not triggered on Wifi disconnect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5365395/