Brad Fitzpatrick created a garage door application for his G1 Android-based Google Phone. This would be noteworthy enough, but the interesting thing about Brad's hack is that it opens the garage door automatically as he approaches his home.
I got it all working. I now have an Android Activity (GarageDoorActivity) which interacts with an Android Service I wrote (InRangeService), letting me start and stop the service's wifi scanning task. The service gets the system WifiManager, holds a WifiLock to keep the radio active, and then does a Wifi scan every couple seconds, looking for my house.


When my house is in range, it does the magic HTTP request to my garage door opener's webserver (HMAC-signed timestamped URL, for non-replayability/forgeability if sniffed) and my garage door opens. Complete with a bunch of fun Toast notifications (like Growl) and Android Notifications (both persistent ongoing notifications for background scanning, and one-time notifications for things like the garage door actually opening).

So when Brad comes home, he starts the application which scans the WiFi network and then opens the garage door as soon as his home network is in range. He even describes an automated version where the phone constantly monitors the network for common scenarios. For instance, your if your phone sees your work network disappear, followed an hour later by your home network appearing, it could safely assume you have come home from work, opening the door without any interaction.

This is compelling support for a fully hackable, open source device. With normal iPhone development, you don't this level of deep access to be able to monitor WiFi connectivity or run an application as a background process.

Brad's released the source code for this one. If this app gives you any ideas, his code might be a good place to start. Just make sure to send us a link to your Android hack when you get your G1 to turn lights on and off when you walk around the house.

Android Garage Door Opener
Download the Java Source

Article Source: http://www.hackszine.com/