WiFi 连接已连接但无法工作:代码还是 Android 错误?
我编写了一个应用程序,它使用警报管理器每分钟执行一项服务(持有唤醒锁来执行整个执行)以在网络上上传数据,并且有时它工作得很好。
事实上,使用 Logcat(在手机上)时,我发现有时 WiFi 连接不起作用。状态栏上的图标没问题,我把wifi待机设置为“从不”。
有时应用程序可以正常运行 20 多个小时,有时只需 40 分钟,然后 wifi 似乎就断开了(但仍然有图标和配置权设置)。
进行最后一次测试时,我尝试打开浏览器,但它也不起作用!要重新启动上传,我需要禁用并启用 wifi...所以我认为问题出在 android 中。
我的设备是配备 Android 2.2 的 Samsung Galaxy ACE
I wrote an app that use Alarm manager to execute a service (that hold a wakelock to perform the entire execution) every minutes to upload data on net, and it works perfect....sometimes.
Infact using Logcat (on phone) i saw that sometimes the WiFi connection doesn't work. The icon on the status bar it's ok, and i had set "never" for wifi standby.
Sometimes the app is running ok for more than 20 hours, some other times just 40 minutes and then wifi seems to be down (but there is still icon and configuration rigth set).
Doing a last test i tried to open the browser and it doesn't work too! Torestart the upload i need to disable and enable wifi...So i think that the problem is in android.
My device is Samsung Galaxy ACE with Android 2.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前,这个问题太宽泛,无法回答。也许您可以发布您提到的代码?
另外,为了进一步调试,
更新:
听起来可能是您网络上的 DNS 问题。当 wi-fi “关闭”时,您能否检查 DNS 解析是否在同一网络中的其他设备(使用相同的 DNS 服务器)上正常工作?
Right now, the question is too broad to answer. Perhaps you can post the code that you mention?
Also, for further debugging,
Update:
Sounds like it could be a DNS issue on your network. When the wi-fi is "down", can you check if DNS resolution works on other devices in the same network (that use the same DNS server)?
我已经解决了仅在操作之间禁用和启用连接的问题。
I have solved only doing a disable and enable connection bettween the operation.