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 22.214.171.124
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!)
Hope you found this post useful...
...so please read on! I love writing articles that provide beneficial information,
tips and examples to my readers. All information on my blog is provided free of
charge and I encourage you to share it as you wish. There is a small favour I ask in return however -
engage in comments below, provide feedback, and if you see mistakes let me know.
If you want to show additional support and help me pay for web hosting and
domain name registration,
donations, no matter how small, are always welcome!
Use of any information contained in this blog post/article is subject to this disclaimer
Other posts you may like...