我想指定 wifi 的频率(或信道)以加快 wifi 扫描。
我研究过android 5.0.2源码,发现 android.net.wifi.WifiScanner Android API 中的类。这个类的评论是这样说的
This class provides a way to scan the Wifi universe around the device Get an instance of this class by calling Context.getSystemService(Context .WIFI_SCANNING_SERVICE).
但是当我尝试使用以下代码使用它时:
Context.getSystemService(Context .WIFI_SCANNING_SERVICE)
在Android Studio 1.0(SDK:android 21 for complie)中,IDE提示没有这样的“WIFI_SCANNING_SERVICE”,尽管在文档中有描述。
我还在 android.net.wifi.WifiManager
类中尝试了 startCustomizedScan(ScanSettings requested)
但我收到一条错误消息“没有这样的功能”。
此函数已记录 here
请告诉我如何使用上述服务和/或功能。
最佳答案
您不能按原样使用 Context.WIFI_SCANNING_SERVICE
静态变量 marked作为 @SystemApi
。如评论 here 中所述,系统 API 不打算供其他标准 Android 应用程序使用。 :
...These APIs are not guaranteed to remain consistent release-to-release, and are not for use by apps linking against the Android SDK...
关于java - 我在 android 5.0.2 源中找到 WIFI_SCANNING_SERVICE 但无法使用此服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29557034/