当设备进入睡眠模式的WiFi锁不工作 [英] WiFi lock is not working when device goes to sleep mode

查看:176
本文介绍了当设备进入睡眠模式的WiFi锁不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面对面的奇怪问题,当我运行在设备上的Andr​​oid应用程序,要么将在前台或后台运行,它不应该失去WiFi连接,因为我有得到WiFiManager和获取该锁服务的onCreate()方法,并释放它的onDestroy方法。但面临的问题,以保持原来的WiFi设备时进入睡眠模式,那么有没有什么办法,使无线网络开启,即使设备进入睡眠模式。
我不能获得锁来唤醒设备,因为情况是我们的应用程序将运行总是如此,每当用户将无法使用,设备应进入睡眠模式,但wifi连接应始终打开。

I am facing one strange problem, when i run my android application on the device so either it will be running on foreground or background , it should not loose the WiFi connection, for that I have get the WiFiManager and acquired the lock in Service's onCreate() method and release it on onDestroy method. But facing problem to keep WiFi turned on when device goes to sleep mode, so is there any way to make WiFi turned on even if device goes to sleep mode. I can't acquire the lock to wake up the device because scenario is our application will run always so whenever user will not use, device should go to sleep mode but wifi connection should always be turned on.

请做帮我解决这个问题,请大家分享一些样品code也。

Please do help me resolve this issue, please share some sample code also.

问候,
皮克斯

Regards, Piks

推荐答案

尝试使用服务。只需插入您的无线连接code在一个服务,这将在后台一直运行下去。

Try to use Services. Just insert you wifi connection code in a service, and this will run forever in background.

这篇关于当设备进入睡眠模式的WiFi锁不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆