Android Question Make WiFi stay on

Discussion in 'Android Questions' started by aaronk, Aug 4, 2015.

  1. aaronk

    aaronk Well-Known Member Licensed 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: http://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 ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Have you tried to acquire a partial local with PhoneWakeState?
     
  3. aaronk

    aaronk Well-Known Member Licensed User

    Using the following code seem to do the job:

    Code:
    Dim pws As PhoneWakeState
    pws.KeepAlive(
    True)
    pws.PartialLock
    Thanks for pointing me to the right direction.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice