Wednesday, November 30, 2011

GetTheWeather

I wanted to test out some location based app ideas so I created an Android app to fetch the weather via the Yahoo PlaceFinder and Weather APIs.


App works by first getting the device's location as latitude and longitude either via the Android LocationManger nettwork or gps providers. The coordinates are sent to the Yahoo PlaceFinder API in order to get a WOEID (where on earth id) for the coordinates. The WOEID is then passed to the Weather API in order to get the forecast for "today". All communication with Yahoo is done via HttpClient with each request running in a background task via AsyncTasks. The forecast is then displayed to the user via some simple text and image views.

Something important I learned with this project:
  1. GPS takes a long time before it provides coordinates. I get better results using the Network to find location. Of course if you need fine grain coordinates then GPS is the only way to go. Searching around it seems other people have this issue too. But there are ways deal with this problem.


Source:
https://github.com/machinezilla/GetTheWeather

No comments:

Post a Comment