Saturday, June 20, 2015

My Experience with Weather API for Android

Are you like me wanting to write an android app and use weather API and do not know where to start. Your search ends here. (and the works begins here as well :-))

I started out writing a World Time App which list the Cities and their times based on User selected Cities. It received good response and built my confidence do more with it. 

Now i am extending the app to include weather details for each city that user has selected. 
My hunt for Weather API started - I incorporated the Yahoo Weather API spent 1 week to test it out and also switched back and forth on the layout to display the Weather details.
With all that done, when i was browsing through the weather details and Android forum, i found that the Yahoo API is only for personal and non-commercial use.
I then researched for all weather APIs and the cost structure. Just to save some time, though you are free to look at the comparisons, OpenWeatherMap API was the best in terms of usage and price with roughly around 1200 api calls per min.
So now i am now using the OpenWeatherMap API for my Weather details.
The one thing to bear in mind when you this weather API is that the temp_min and temp_max is not the High and Low Temp we see in a typical weather Widget. This min/max is the min and maximum for Current Temperature in the city chosen as a reference. So in major cities there could be some variation for the Current Temp and the user might take an  average of the temp_min and temp_max.

Regardless of which Weather API you choose to use, you need to cache the results, so that you do not make unnecessary calls within a min. 
Now how to do that and what is the most efficient way to do it will be the topic for my next Post...      



No comments: