Android Froyo 2.2 and Wifi

Last Updated:

  1. hemant_puri

    hemant_puri New Member


    By default, Wifi sleep policy is "Sleep on screen idle".

    With this policy, is it possible for a Background Service at a later time to wake up Wifi using some API?

    Am trying the following, but does not work:
    When my Background Service wakes up, it calls "ConnectivityManager.getActiveNetworkInfo()" to get active network.
    Since, the wireless is off on idle, I tried waking it up using "WifiManager.startScan" on a previously used Wifi connection.
    But still dont get Wifi connectivity.

    Any ideas?
    I preferably do not want to change my sleep policy to "Never".


  2. Boogs

    Boogs Well-Known Member

    You're looking for the WifiLock in the Wifi Manager class. Take a look at this.
  3. hemant_puri

    hemant_puri New Member

    Looks like WifiLock works only if you have an Active Wifi Connection. Then when you acquire the lock, it ensures that Wifi will be active until the lock is released.

    In my case, looking at something to activate the wifi from a background service (which wakes up periodically)
  4. Boogs

    Boogs Well-Known Member

    Ah... in that case, I don't know how to acquire a Wifi signal when the phone is idle. If you find out, then let us know!

  5. robinvane

    robinvane New Member

    Hi hemant_puri,
    I have the same problem, do you know how to solve it?
    Thank you!

Share This Page