You’ll see an empty constant called API_KEY. Open the class OpenWeatherAPI located in the api folder. Its value is unique and stored on the account you just created.Ĭopy the key, and then head back to Android Studio. Click the Sign up link in the description.You’ll need an API key to request the location to OpenWeatherMap. It also updates all the views and is where you’ll write the in-app update logic. MainActivity.kt: You’ll use this to check if conditions are met to make a weather request.
utils: You’ll use a set of functions to get general information - if the location service is enabled or not, formatting measurements, etc.model: You’ll use these classes to parse and hold the information received on the response body.These classes provide an abstraction of the entire process. api: You’ll use OpenWeatherMap to retrieve the current weather information for your city.Browsing through the explorer on the left, you’ll see a set of subfolders and classes. Next, survey the different folders and files of the project. The app works but will also be mum on key information such as temperature and wind speed. After it synchronizes, you’ll see a screen like the one below:Ĭompile and run. More importantly, the app will feature an option to help users maintain the latest version. In this tutorial, you’ll build an app to display the weather information for your town. Open the start project in Android Studio 3.5 or later. To download the project materials, click the Download Materials button at the top or bottom of this tutorial. If you’re new to Kotlin development, first check out our tutorial Kotlin For Android: An Introduction. Note: This tutorial assumes familiarity with Kotlin.