This is a sample Android weather application built for my YouTube channel. A link to the video where this app was built can be found here. This example includes a data model, making network calls using Android Volley and a utility class.
- Download or clone this project
- Import into Android Studio
- Create a Open Weather Map API account here if you don't have one
- Create an Open Weather Map API key and add it to the project inside of the file CurrentWeatherService.java replace the API_KEY static variable value with your API key
public class CurrentWeatherService {
private static final String TAG = CurrentWeatherService.class.getSimpleName();
private static final String URL = "https://api.openweathermap.org/data/2.5/weather";
private static final String CURRENT_WEATHER_TAG = "CURRENT_WEATHER";
private static final String API_KEY = "YOUR API KEY HERE"; <--- INSERT API KEY HERE
private RequestQueue queue;
...
- Run the app on an emulator or device (ensure you have a network connection)
- PROFIT!
The icons used in this project were downloaded from here and the mapping from weather icon to Open Weather Map API condition id was found here