Developer EventsWindows Azure Developer Stories
General ResourcesWindows PhoneWindows Azure
These postings are provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.
Last night, while picking up a Windows Phone that I’d loaned to a developer for the weekend so he could give his app a proper test on a real device instead of the emulator, I decided to fill up the gas tank on the Deathmobile, named after the car in the movie that inspired my academic career – Animal House.
(Yeah, it’s 12 years old, but with only 110,000 km on it – living in the city, doing lots of bike commuting and living right by a subway station has a lot to do with the low mileage.)
The gas station was in Vaughan, a suburb just north of Toronto, and regular gasoline sold for CAD$1.05 a litre (for my American readers, that’s USD$3.91 a gallon). As I got closer to home, I noticed that the gas stations were charging CAD$1.00 a litre, or USD$3.72 a gallon. I’d pumped 40 litres of fuel into my car, and had I waited until I got closer to home, I could’ve saved two dollars. For me and this one instance, that’s a minor loss, especially since I only have to fill my tank once every two or three weeks. For someone who does a daily commute, that sort of savings adds up.
However, this incident gave me an idea, and hey, two bucks is a small price to pay for inspiration. How about a phone app that lets you know whether you’re getting a good deal at the gas station?
There are sites like GasBuddy.com, a network of just under 200 city-specific sites that track gas prices. According to their registration page, gas prices vary by 10 – 15 cents a litre (30 – 50 cents a gallon) within a city. The site boasts a membership of 700,000 people sharing gas prices in their area and acting as gas price data collectors and reporters. Each GasBuddy city’s site displays the latest prices reported for that city, along with the handle of the member who posted the price.
Here’s a screenshot of the Toronto-specific GasBuddy site, TorontoGasPrices.com:
It’s one thing to cruise this site on a nice big monitor at home or a laptop or even a netbook. On a phone, it’s a bit of a challenge to read:
Yes, I know you can always use pinch zoom, but then you’re making the user do a lot of scrolling and paging, just to get an answer to a simple yes/no question: Am I getting a good deal at this gas station?
A mobile app that answers this question should adopt the Windows Phone 7 design philosophy of “Glance and Go”. It should give you the answer in a form like this:
For the app to work, you’ll need at least two pieces of information:
Ideally, you’ll want to use GPS for getting the user’s location. You can access the GPS on Windows Phone 7 through the Location service, which lives in the System.Device.Location namespace. There’s pretty good coverage of it in the documentation, and I’ll post some code examples in a later article. You may also give the user the user the option of looking at gas prices in other cities, especially nearby ones.
Getting the gas prices for a specific area is a little trickier. You have a couple of options, listed in order from most to least feasible or realistic:
There’s your challenge. I’ll write a follow-up article with example code, but in the meantime, fire up Visual Studio and get on it! If you write an app and submit it to Marketplace, drop me a line and let me know.
This is the second in a series of Windows Phone 7 App Challenges, in which I present ideas for apps for Windows Phone 7 developers.
In the previous installment in this series, I presented users with the idea to write a timer that people could use for the Pomodoro Technique, a very simple but very effective method to boost your personal productivity. You can read more about it (and see some code, too) here.
This article also appears in Global Nerdy.
Tip: To make your life much easier, if you can get an RSS/ATOM Feed you can use the System.ServiceModel.Syndication assembly from Silverlight 3. It is much quicker to parse a formatted document than brute forcing some XML. I'm using it in my Polymorphic Podcast App and it seems to be working great.