Warning: mysqli_query(): (HY000/1712): Index wp_posts is corrupted in /home/thermopyle/blog.contriving.net/wp-includes/wp-db.php on line 1821
android | Contriving

Tag Archives: android

Woofi and finding an access point

Wi-Fi Alliance logo

Image via Wikipedia

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.

woofi, a location-aware WiFi switcher for Android devices.

Woofi

My most recent project is an app called woofi.  Let me quote the apps description from its market page:

Simply put, with woofi you define locations like “home”, “work”, or “Joe’s house”, and woofi turns your WiFi radio on when near those points and off when not.

More detailed explanation:

Say, for example, that the only place you connect your phone to WiFi is at home. This means you don’t need for the WiFi radio in your phone to be on when you’re not at home. The rest of the day it’s just sitting there trying to connect to access points and wasting battery.

With this app you would save your “home” location (and wherever else you connect to WiFi regularly…like at the office), and the app would keep track of your location throughout the day and when you weren’t near these saved locations turn your WiFi radio off, and then when you were near them it would turn your WiFi radio back on.

You can, of course, simply turn the WiFi radio on and off manually when you are at-home/not-at-home, the only purpose of this app is to automate doing this for you. I always forget to do this manually…thus the idea for this app.

Most people seem to leave their WiFi on all the time and not realize that it’s on because it just connects to networks that they’ve connected to before automatically.

Here’s what normally happens without this app: Once you’ve connected to your home (or office, or wherever) WiFi, Android will just connect to your home WiFi every time you’re in range. The only way it knows to do this is because the WiFi radio in your phone is on all the time looking for WiFi networks to connect to.

This app replaces that procedure by checking your phones location and leaving the WiFi radio off unless it is needed. Doing this saves battery life.

Coming soon expect some posts about the logic and trade offs made in the development of this app.

Android Application Development for Dummies

I’ve been working through the book Android Application Development for Dummies and noticed a little problem on page 182, paragraph 3 where it states:

At this point, you can install the Silent Mode Toggle application, long-press the home screen, and choose the Widgets category; now you should see the Silent Mode Toggle present.

The problem is that this isn’t true.  It’s not till the next page where you edit the AndroidManifest.xml file will you be able to see the widget.

Hopefully, this helps anyone getting frustrated trying to get the widget to show up!

On a related note, the author, Donn Felker, has been very responsive to emails about this issue.  He even offered to take the time to go through the code I’d already written.  I’ll definitely be looking for other books by him because of this.  Thanks Donn!