3

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?

Community
  • 1
  • 1
Raist
  • 72
  • 1
  • 7
  • I've noticed this happen on some devices as well. The solution that I found (granted I didn't really dig) was not programmatic, I had to manually switch off and then on the wifi radio with a toggle widget. – FoamyGuy Jan 11 '12 at 20:39
  • See : http://stackoverflow.com/a/19968708/281545. Is that what you want ? And by the way if both resist are the same how about unifying your accounts ? ;) – Mr_and_Mrs_D Nov 14 '13 at 03:30

1 Answers1

1

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?

user931366
  • 674
  • 5
  • 9
  • Also, if your using Multicast, there's a different lock for that. – user931366 Jan 11 '12 at 21:26
  • I can't do that. To lock my wifi connection i have to keep her always waked, and this can't be done. (battery issues) Just create a wifi lock every 5 min will not wake up wifi. Thanks anyway! – Raist Jan 14 '12 at 03:04