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.
– getNewIcon (icon, weatherIcon) function is then called which will take the existing Google Icons and match it to a new icon of your choice. So for example if the weather is Sunny, all you need to do is add a sunny.png (@2x.png for retina display) and the app will automatically use the new icons instead! Want to use Google’s icons instead? No problem. In functions.js, comment out line 241 with the double backslash like so: //(getNewIcon(icon, weatherIcon) and it will use the default Google icons instead. Easy!

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 .

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 *