¡@

Home 

2014/10/16 ¤W¤È 08:27:37

android Programming Glossary: wifilock

Android : Reconnect to Wi-Fi after entering coverage area while screen turned off

http://stackoverflow.com/questions/19148765/android-reconnect-to-wi-fi-after-entering-coverage-area-while-screen-turned-of

completely different results. Base Test Keep the screen turned off during this test. The application should hold a WifiLock. Walk out of WiFi coverage and stay there for a minute. Walk back into coverage. Result The Wifi is not reconnected immediately.. final scary looking solution hack the Wifi Sleep Policy affected the results. This confused me since I am holding a WifiLock the entire time which I thought was equivalent of Never . Changing the Wifi Sleep Policy programmatically does not work.. mConnectionReceiver private volatile static CountDownLatch latch @Override protected void doWakefulWork Intent intent WifiLock _wifiLock null WifiManager wm WifiManager getSystemService Context.WIFI_SERVICE boolean failedToConnect true if wm null..

How do I keep Wifi from disconnecting when phone is asleep?

http://stackoverflow.com/questions/3871824/how-do-i-keep-wifi-from-disconnecting-when-phone-is-asleep

extends BroadcastReceiver public void onReceive Context context Intent intent WakeLock wakeLock null WifiLock wifiLock null try PowerManager pm PowerManager context .getSystemService Context.POWER_SERVICE acquire a WakeLock to keep.. WakeLock acquired WifiManager wm WifiManager context.getSystemService Context.WIFI_SERVICE wifiLock wm.createWifiLock WifiManager.WIFI_MODE_FULL MyWifiLock if wifiLock.isHeld wifiLock.acquire Log.i ServiceAlarmBroadcastReceiver WifiLock.. wm WifiManager context.getSystemService Context.WIFI_SERVICE wifiLock wm.createWifiLock WifiManager.WIFI_MODE_FULL MyWifiLock if wifiLock.isHeld wifiLock.acquire Log.i ServiceAlarmBroadcastReceiver WifiLock acquired context.startService new Intent..