A small Android app that displays current weather, hourly and daily forecasts for the user's current location. Built with Jetpack Compose and following a Clean Architecture + MVVM structure.
your_file_name.mp4
Screen_recording_20251005_103349.mp4
- Single-screen Compose UI showing:
- Current conditions (temperature, weather description, icon)
- Hourly forecast
- Daily forecast
- Details cards (humidity, pressure, wind, UV index, etc.)
- Clean architecture (domain, data, presentation layers)
- MVVM with a Compose-friendly ViewModel
- Koin for dependency injection
- Ktor HTTP client + kotlinx.serialization for networking
- Uses Google Play Services Fused Location to obtain the device location
- Uses Open-Meteo (https://open-meteo.com) for weather data and OpenStreetMap Nominatim for reverse geocoding (no API key required)
app/src/main/java/com/thechance.weatherdata— remote data sources (Ktor clients), local (fused) location provider, mappersdomain— models, repository interfaces, use cases, domain exceptionspresentation— Compose UI, ViewModels, UI models and themesdi— Koin modules wiring the app togetherWeatherApplication— Koin initialization
- Android Gradle Plugin: 8.10.1
- Kotlin: 2.0.21
- Jetpack Compose (BOM): 2024.09.00
- Ktor client: 3.1.3
- Koin: 4.0.4
- Google Play Services Location
- kotlinx.serialization / kotlinx.coroutines
(See gradle/libs.versions.toml and app/build.gradle.kts for full details.)
The app requires the following runtime permissions:
ACCESS_FINE_LOCATION/ACCESS_COARSE_LOCATION— to fetch device location via FusedLocationProviderINTERNET— to call the remote APIs
The AndroidManifest.xml already declares these permissions. The app's UI / ViewModel maps permission and location errors to friendly messages.
- Weather: Open-Meteo (https://api.open-meteo.com/v1) — used by
WeatherRemoteDataSourceImpl. Open-Meteo is free and does not require an API key. - Reverse Geocoding: Nominatim (https://nominatim.openstreetmap.org) — used by
GeocodingRemoteDataSourceImplto obtain a city name. No API key needed, but please respect usage policy for heavy traffic.
No API keys or secret configuration are required to run the app.
- On start,
WeatherViewModeltriggersloadWeather(). GetCurrentLocationUseCaseretrieves the location fromLocationRepositorywhich uses Google Play Services (FusedLocationDataSource).GetWeatherUseCasecalls theWeatherRepositorywhich uses a Ktor client to fetch weather data from Open-Meteo.GetCityNameUseCasecalls Nominatim to resolve a readable city name for display.- The domain objects are mapped to UI state models via
presentation.mapperand rendered using Jetpack Compose.
Requirements:
- Android Studio Flamingo or newer (recommended)
- Android SDK configured for API level 36 (compileSdk 36)
- Device or emulator with Google Play services for Fused Location
Steps:
- Open the project in Android Studio.
- Let Gradle sync and download dependencies.
- Build and run on an emulator or device (API 26+).
Note: The app uses Google Play Services for location. Use an emulator image that includes Google Play, or test on a real device.
Common errors are mapped to user-facing messages in WeatherViewModel.mapErrorToMessage():
- Location permission issues
- GPS disabled
- Network / server errors
- Data parsing issues