Android 手机可以暂停 wifi 扫描请求吗?
我编写了一个 Android 应用程序来请求使用 WifiManager 扫描周围可用的 wifi 信号,然后将结果转储到文件中。程序运行正常,但是出现了这个奇怪的错误。
最初我请求每 30 秒扫描一次,一切正常。然后我尝试每两秒请求一次扫描,我得到了这个奇怪的错误。几分钟内一切都会正常工作,然后两次扫描请求之间的时间无缘无故地从 2 秒跳到 50 秒。然后,对于另外四次扫描,它将以 2 秒的间隔进行扫描,然后跳到 50 秒的间隔,并继续一致地执行此操作。
如果时间间隔较大,则不会出现此错误。以前有人遇到过这个错误吗?有办法预防吗?或者如果扫描请求过于频繁,Android 会自动取消扫描请求吗?
感谢您的帮助!
NS
I wrote an android application to request a scan for available wifi signals around, using the WifiManager, then dump the results to a file. The program works fine, but this weird bug occurs.
Initially I was requesting a scan every 30 seconds, and everything worked fine. I then tried to request a scan every two seconds, I get this strange bug. Everything will work fine for a few minutes, then the time between two scan requests jumps from 2 seconds to 50 seconds for no reason. Then, for four more scans, it will scan at 2-second intervals, then skip to a 50-second interval, and it continues to do this consistently.
With larger time intervals this bug does not appear. Has anyone experienced this bug before? Is there a way to prevent it? Or does Android automatically cancel scan requests if they are too frequent?
Thank you for your help!
NS
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有机会发布一些代码吗?
这可能是开发人员为了避免耗尽电池而故意设置的限制吗?
Any chance of posting some code?
Could this be an intentional limitation placed upon developers to avoid killing the battery.