One of the main points of an app like woofi is to conserve battery life, so implementing features in a resource-conscious manner is paramount.
Of course, the biggest thing we do is make sure the WiFi radio is on for the smallest amount of time possible. This brings us to the first trade off we have to juggle. We can’t know for sure if we want the WiFi radio to be turned on without turning it on and checking for available access points. If we turn on and then connect to an access point, all is good. If we turn on and there is no access point to connect to we just wasted a bit of your battery life.
What we want to do is turn on the WiFi radio and then only stay on for the absolute shortest time possible. The problem is this: we don’t know what the shortest time possible is! Some Android devices and some access points take longer than others. If we only turn on WiFi for 5 seconds and then decide no access point is available, but your device and access point normally take 10 seconds to establish a connection we’ve failed the user.
Our solution to this is to pick a reasonable default time, and allow the user to increase it if they have a slow-to-connect access point.
- An Android WiFi App I Need (avc.com)