问题
Backround: Android 2.x running on a Tablet. Is there any way to prevent the WiFi from power off when there are no connection incoming or outgoing? I need the WiFi to stay alive for incoming connection from a server. For now I am doing keep alive calls but that's not that nice. I've googled that already and found out that it is something about powersaving. Is there anyway to come around this?
Thanks in advance for any Help on this!
回答1:
Try to go to Settings -> Wireless -> Wifi Settings -> Menu -> Advanced -> WiFi Sleep Policy and change the policy.
This may avoid the behavior you're describing.
回答2:
Try the WifiLock just like the WakeLock.
http://developer.android.com/reference/android/net/wifi/WifiManager.WifiLock.html
来源:https://stackoverflow.com/questions/5976469/prevent-wifi-from-power-off