سؤال

I have an app that sends data every 5 min, i saw that wifi after some time goes sleep and stop working.

I found one solution that is use a WakeLock SCREEN_DIM_WAKE_LOCK. The thing is: i can't have my screen waking (even dimmed) in this process. PARTIAL_WAKE_LOCK doesn't work in this case (to wake up wifi).

There is another solution for this problem?

UPDATE:

I'm using this topic method to lock wifi, and isn't work either: Wifi sleeps, even with Lock

There is something wrong?

هل كانت مفيدة؟

المحلول

Have you tried using WifiManager.WifiLock? Creating and holding a wifiLock is the way your suppose to keep your radio awake enough to send.

Also check: Just prior to sending your message, print out what ConnectivityManager thinks about your TYPE_WIFI connection. Does the ConnectivityManager think all is well with your wifi?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top