android.net.wifi.WifiManager 中缺少方法
在网站上 androidjavadoc.com ,WifiManager
类中列出了 startScanActive
方法,该方法可以执行主动 wi-fi 扫描。最近也这里讨论过 。
然而,当我尝试在 Eclipse 中使用该方法时,找不到它(未定义)。 startScan
是。我尝试了 Android SDK 附带的所有 android.jar 版本(从 2.3 到 3.1)。
该功能存在吗?我怎样才能访问它?
多谢
On the site androidjavadoc.com, a method startScanActive
is listed in the class WifiManager
that makes it possible to perform an active wi-fi scan. 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如我提到的,请查看官方文档。它不在那里。因此,它不是公共 API 的一部分,您不应调用它。即使它是公开的,也不意味着你可以调用它。
在未来的版本中,未记录的 API 调用可能会在没有通知的情况下随时消失,这将导致您的应用程序崩溃。
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.
根据引用的资源,这是我自己的解释:
Android SDK 中不包含该函数。
在源代码中,它标有 Javadoc 标签
@hide
(源),这会导致它被排除在文档之外,但也不会为 SDK 进行编译。出于测试目的,可以编译并使用自己的 jar 文件。但就手机本身而言,该方法是否存在将取决于供应商。
类似的问题。
在 androidjavadoc.com 上发布。
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.
当其他一切都失败时,请转到根源:
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
自 1.6 起,它是 WifiManager 中的公共方法,尽管您说 Eclipse 找不到该方法是正确的,因为一些奇怪的原因。
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.