Coders Packet

Weather Application using API calls in Java and Android Studio

By Saptneel Sharma

The app makes use of OpenWeatherMap's API to obtain weather and display it in a custom design.

The basic idea behind the application is to understand the usage of API calls in Java and Android.

For this application, I have used OpenWeather's free Current Weather API. All one needs to do is sign up and then obtain the key for the API.

After obtaining the key, you can look up their documentation for various ways of making API calls. One of the basic ways is:

api.openweathermap.org/data/2.5/weather?q={city name}&appid={API key}

This can be used to receive weather details in JSON format, which can then be displayed in a custom-designed activity.

OpenWeather also provides API calls using geo-coordinates like this:

api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}

So, we can also get location permission and automatically display the weather without the user entering a city.

Here are some screenshots of the splash screen and the application.

Weather1 Weather2 Weather3 Weather4

Download project

Reviews Report

Submitted by Saptneel Sharma (saptneel)

Download packets of source code on Coders Packet