NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ
for more details.
I've had my JPhotoFrame project
using the OpenWeatherMap API
for some time now, at least since Yahoo messed up its own weather service
. I thought it would be useful to share a bit of code on how to use the OWM API
, so here it is.
I'm using the OWM JAPIs 188.8.131.52
library, which is compatible with the OWM 2.5
In order to use OWM
programatically, an API key
is required. This unfortunately means that the end user has to get their own key too, it's free and not a big deal but is a little bit of an annoyance to have to go through. To get an API key
, first an account is required, one can be created on the OWM sign-up page
. After signing up, the API key
is available. Update: on the updated site there is an API keys tab.
So here's the bit of code to get a three day forecast
and display the minimum and maximum temperature for those days. All of the code is straight forward, it's just a matter of using the right classes.
This is the output that the code above produces (it's hot in Australia on the first day of 2017!)
A quick disclaimer...
Although I put in a great effort into researching all the topics I cover, mistakes can happen.
If you spot something out of place, please do let me know.
All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle).
Use of any information contained in this blog post/article is subject to this disclaimer
Other posts you may like...