?

Log in

No account? Create an account
Android Garage Door Opener, part 2 - brad's life [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Android Garage Door Opener, part 2 [Oct. 26th, 2008|12:06 pm]
Brad Fitzpatrick
[Tags|, , , ]

This is a follow-up to my previous post to say:

SO. FUCKING. AWESOME.

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).

I just threw on some shoes and hopped on my motorcycle to do a test lap around the neighborhood. When I got to the corner, I pulled up the activity and press "Start" (aka "Going home now"). A lady on the corner saw me playing with my phone on my motorcycle and said, "The reception's not so good up here." I thanked her, not wanting to explain what I was actually doing.

I then finished the lap around the block and the garage door started opening a few houses away. By the time I pulled up, I could already back the bike into the garage. HELL YES.

Update 2008-11-16: The source code is now available.
LinkReply

Comments:
[User Picture]From: bandicoot
2008-10-26 08:50 pm (UTC)
Can't you combine it with GPS data so the garage door just opens when you get close enough?
(Reply) (Parent) (Thread)
[User Picture]From: brad
2008-10-26 08:51 pm (UTC)
In theory, but the GPS kinda blows even with a direct view of the sky. I don't trust it to work in my pocket at all.
(Reply) (Parent) (Thread)
[User Picture]From: mart
2008-10-26 10:21 pm (UTC)

I've found in the past that non-assisted GPS has real trouble getting going without an unobstructed view of the sky, but once it's got going it'll work fine in my pocket. Not sure if that applies to a GPS reciever embedded in a load of other transmitters and electronics, though, and kinda sucks for your "I'm heading home right now" use-case. Hopefully once they get the assisted GPS working it'll be better, though.

(Reply) (Parent) (Thread)
From: (Anonymous)
2008-10-28 07:19 am (UTC)
What about using cellid? You must have GSM/UMTS radio on anyway (well, if you want to use your G1 as phone), so why not just pull cell ids and start the wifi scanning when you are in your "home cell"?
(Reply) (Parent) (Thread)