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.
Please do help me resolve this issue, please share some sample code also.
Regards,
Piks
Try to use Services. Just insert you wifi connection code in a service, and this will run forever in background.