开发者

Missing method in android.net.wifi.WifiManager

On the site androidjavadoc.com, a method startScanActive is listed in the class WifiManager that makes it possible to perform an active wi-fi s开发者_JAVA技巧can. It has been discussed here recently, too.

Nevertheless, when I try to use that method in Eclipse, it is not found (undefined). startScan is. I tried that with all android.jar versions coming with the Android SDK (from 2.3 to 3.1).

Does the function exist? How can I get access to it?

Thanks a lot


As I mentioned, look at the official documentation. It's not there. As such, it's not part of the public API, and you should not call it. Even if it's public, it doesn't mean that you can call it.

Undocumented API calls can disappear without notice at any time in future versions, which will cause your app to break.


Here goes my own explanation, based on the cited resources: The function is not contained in the Android SDK. In the source code, it is marked with the Javadoc tag @hide (source), which causes it to be excluded from the documentation but also not to be compiled for the SDK. For testing purposes, an own jar file may be compiled and used. But on the cell phone itself, it will depend on the vendor if the method will be present.

Similar question. Post on androidjavadoc.com.


When everything else fails, go to the roots:

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.3.4_r1/android/net/wifi/WifiManager.java#WifiManager.startScanActive%28%29

It is a public method in WifiManager since 1.6, although you're correct in saying that Eclipse does not find that method, for some weird reason.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜