Question

I have three android devices: a Samsung Galaxy Note 10, an HTC Desire C, and a Sony Xperia E. In addition, I have a service that listens on a specific TCP port on these devices. The WIFI policy is set to "Always on" in all of my devices. My service acquires a WIFI_MODE_FULL and a PARTIAL_WAKE_LOCK so the CPU and WIFI are always there. After some time, when I want to connect to these devices from my server something bad happens.

  • Samsung Galaxy Note device always behaves correctly
  • HTC Desire becomes unreachable
  • Sony becomes unreachable

I Pinged these devices to see if they are there or not. The results is:

  • Samsung device always responds to ping requests immediately and normally
  • HTC, and Sony devices are sometimes unreachable, and sometimes they respond. However, they respond with a very long latency even when their screen is on (time column of ping is sometimes about 5000ms)

I know that there are some issues with the WIFI policy:

Why even when the screen is on ping time is like this? In addition, I know that the CPU clock decreases when screen goes off, even if you hold a wake lock. Can this behavior cause problems in the Service code that handles TCP connections?

Was it helpful?

Solution

Manufacturers want to be able to brag about having the longest battery life. To that end, they'll shave existing features to their very bone to deliver on that battery life.

And yes, it can cause problems and it does cause problems, but that's one of the many reasons you should be programming defensively. In other words, make sure your application is prepared to deal with dropped packets and possible longer delays.

Hopefully, your questions weren't entirely rhetorical and you actually wanted an answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top