Google Weather API Interface (Templates)

Using Google’s Weather API , add the data that you need to make your app cutting edge.

Easy to add to your current app, or build on to this one!

Functions are separated out into there own functions.js file.

A single call to the getCurrentWeather() function will:

– Get the Lat/Lon and then use reverse GeoLocation to get the Zip and State
(Variables are already set in place to get zip,full address, street & city if you wish to use those as well)
– updateWeather (mylatitude, mylongitude) is then called which will parse the XML of Google WX API . The current Day, and Forecast info is then set to variables and available to be added to the views. Each day is commented for easy readability.

-UPDATE v1.1 (7/27/11 @ 1800hrs EST )
getNewIcon() function has been replaced for faster and better performance. Please update to the latest file. This new method eliminates nearly 80 lines of code and 3 separate calls to the function. This means it is much less resource hungry for the device.

Custom Weather Icons. Lets face it, Google’s stock icons are less that stellar, so why not spice them up a bit. Included are new icons that you can use (Retina @2x Too!) or easily add your own. Just follow along the naming convention and you will be good to go. The included function will take the existing icon from the XML and use the new icons instead.

Requires the freely available Titanium SDK . Tested on SDK 1 .7.2

Runs on iPhone and iPad.

Complete sample included.

Download Google Weather API Interface (Templates)

Leave a Reply

Your email address will not be published. Required fields are marked *