Android Question Make WiFi stay on

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I have a touch screen where when the deice goes to standby mode it turns the WiFi off.

I am trying to make it so that WiFi never turns off. I have enabled my device to keep the WiFi enabled from the settings 'Keep Wi-Fi on during sleep' and set that to always but the WiFi still manages to turn off.

So from my B4A I want to create a service that will make it so the WiFi never turns off.

I have tried using this code: https://www.b4x.com/android/forum/threads/httpserver-problem-solved.30968/#post-180606
But it still manages to turn the WiFi off.

I have made it so the touch screen never goes into standby mode (screen always on) but I want to make it so if the user presses the power button to make it go into standby mode and allow the screen to turn off but want the WiFi to remain connected to the access point.

Anyone have any ideas on how to keep the WiFi connected to the network even when in standby mode ?
 

aaronk

Well-Known Member
Licensed User
Longtime User
Using the following code seem to do the job:

B4X:
Dim pws As PhoneWakeState
pws.KeepAlive(True)
pws.PartialLock

Thanks for pointing me to the right direction.
 
Upvote 0
Top