1. Check out our companion app, Forums for Android! Download from Google Play

Android Froyo 2.2 and Wifi

Discussion in 'Application Development' started by hemant_puri, Jul 9, 2010.

  1. hemant_puri

    hemant_puri New Member
    Thread Starter
    5

    Feb 8, 2010
    4
    0
    5
    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
    18

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

    hemant_puri New Member
    Thread Starter
    5

    Feb 8, 2010
    4
    0
    5
    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
    18

    Apr 6, 2010
    85
    16
    18
    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
    5

    Dec 1, 2010
    1
    0
    5
    Hi hemant_puri,
    I have the same problem, do you know how to solve it?
    Thank you!
     

Share This Page

Loading...