Android Froyo 2.2 and Wifi


Last Updated:

  1. hemant_puri

    hemant_puri New Member This Topic's Starter

    Joined:
    Feb 8, 2010
    Messages:
    4
    Likes Received:
    0
    Hi,

    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".

    Thanks
    Hemant
     

    Advertisement
  2. Boogs

    Boogs Well-Known Member

    Joined:
    Apr 6, 2010
    Messages:
    85
    Likes Received:
    16
    You're looking for the WifiLock in the Wifi Manager class. Take a look at this.
     
  3. hemant_puri

    hemant_puri New Member This Topic's Starter

    Joined:
    Feb 8, 2010
    Messages:
    4
    Likes Received:
    0
    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

    Joined:
    Apr 6, 2010
    Messages:
    85
    Likes Received:
    16
    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!

    --Boogs
     
  5. robinvane

    robinvane New Member

    Joined:
    Dec 1, 2010
    Messages:
    1
    Likes Received:
    0
    Hi hemant_puri,
    I have the same problem, do you know how to solve it?
    Thank you!
     

Share This Page

Loading...