精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-03-02
1. 检测是否有wifi可用: mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (mWifiManager != null) { List<ScanResult> wifiScanResults = mWifiManager.getScanResults(); if (wifiScanResults != null && wifiScanResults.size() != 0) { } } 2. WifiLock的应用: 这儿有一篇详细的文章介绍http://malaqu.com/?p=1203 WifiLock Allows an application to keep the Wi-Fi radio awake. Normally
the Wi-Fi radio may turn off when the user has not used the device in a
while. Acquiring a WifiLock will keep the radio on until the lock is
released. Multiple applications may hold WifiLocks, and the radio will
only be allowed to turn off when no WifiLocks are held in any
application.
3. 在程序中注册WifiManager.SCAN_RESULTS_AVAILABLE_ACTION和WifiManager.WIFI_STATE_CHANGED_ACTION这两个intent,以关注Wifi的状态,要是程序有需求在wifi可用时做一些操作,这个很有用。 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
浏览 5166 次