Weather-App-using-Java-in-Android


This project is on Creating an Android Weather App using Java. To get the weather information I used OpenWeatherMap API. Informations like Temperature, Pressure, Humidity, Weather status, Time of Sunrise and Sunset etc. are passed from the API.

Visit the blog post on Create a Weather App using Java in Android


Get an API key from OpenWeatherMap

For retrieving data we will use OpenWeatherAPI, and we will be needing an API key for it. Before proceeding please get an API key by registering. You can either follow the attached video above or steps below.

  1. Create a New Account from here.
  2. After login go to here to get the API Key.


Getting weather information using Latitude & Longitude

Suppose you want to request weather information using a Latitude & Longitude of a place, then you should use:

String response = HttpRequest.excuteGet("https://api.openweathermap.org/data/2.5/weather?lat=" + LAT + "&lon=" + LON + "&units=metric&appid=" + API);

where LAT and LON will be the Latitude & Longitude respectively. If you want to implement this project to display weather information of user's current location you'll just need detect the current latitude & longitude. I've already posted an article on Detect Current Latitude & Longitude using Java in Android