wifi connection is getting closed when device is going in sleep/locked state
<p>I developed one application which is having set of activities and one background service , this application will talk to the server over WiFi, so when device is in active state my application is able to communicate with the server over Wifi but when device goes to sleep/locked state, after some time connection is getting close.
So now able to understand why it is happening, it seems like Wifi is getting turned off automatically when device goes to sleep mode.
Is there any way to set the WiFi state as On when my application is running either in foreground or in background?</p>

<p>Please share your idea with some samples.</p>

<p>Regards,
Piks</p>
