当设备进入睡眠模式的WiFi锁不工作
我面对面的奇怪问题,当我运行在设备上的Android应用程序,要么将在前台或后台运行,它不应该失去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.