A modern Android weather application built with Kotlin that provides real-time weather information using the OpenWeatherMap API. The app features location-based weather data, city search functionality, and a clean, intuitive user interface.
- 🌍 Current Location Weather: Automatically fetch weather data for your current location
- 🔍 City Search: Search for weather information in any city worldwide
- 📱 Modern UI: Clean and intuitive Material Design interface
- 🌡️ Detailed Weather Info: Temperature, humidity, wind speed, and weather conditions
- 📍 Location Services: GPS-based location detection
- 🔄 Real-time Updates: Fresh weather data from OpenWeatherMap API
- Language: Kotlin
- Architecture: MVVM (Model-View-ViewModel)
- Networking: Retrofit2 + OkHttp3
- Location Services: Google Play Services Location
- Image Loading: Glide
- Async Operations: Kotlin Coroutines
- UI: View Binding, Material Design Components
- Lifecycle: Android Architecture Components (ViewModel, LiveData)
- Android Studio Arctic Fox or later
- Android SDK 24 or higher
- OpenWeatherMap API key
git clone https://github.com/yourusername/WeatherApp.git
cd WeatherApp- Visit OpenWeatherMap
- Sign up for a free account
- Generate your API key
Create a local.properties file in the root directory and add your API key:
OPENWEATHER_API_KEY=your_api_key_hereImportant: Never commit your local.properties file to version control. It's already included in .gitignore.
- Open the project in Android Studio
- Sync the project with Gradle files
- Run the app on your device or emulator
app/
├── src/main/java/com/example/weatherapp/
│ ├── data/
│ │ ├── api/ # API interfaces and services
│ │ ├── model/ # Data models
│ │ └── repository/ # Repository pattern implementation
│ ├── ui/
│ │ └── viewmodel/ # ViewModels for UI logic
│ ├── utils/ # Utility classes
│ └── MainActivity.kt # Main activity
├── src/main/res/ # Resources (layouts, strings, etc.)
└── AndroidManifest.xml # App configuration
The app requires the following permissions:
INTERNET- For API calls to fetch weather dataACCESS_FINE_LOCATION- For precise location-based weatherACCESS_COARSE_LOCATION- For approximate location-based weatherACCESS_NETWORK_STATE- For network connectivity checks
Key dependencies used in this project:
// Networking
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
// Location Services
implementation("com.google.android.gms:play-services-location:21.0.1")
// Architecture Components
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
// Image Loading
implementation("com.github.bumptech.glide:glide:4.16.0")
// Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")This app uses the OpenWeatherMap API to fetch weather data. The API provides:
- Current weather data
- Weather forecasts
- Weather maps
- Historical weather data
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- API keys are stored in
local.propertiesand not committed to version control - The app uses HTTPS for all API communications
- Location permissions are requested at runtime with proper user consent
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenWeatherMap for providing the weather API
- Material Design for design guidelines
- Android Developers for documentation and best practices
If you encounter any issues or have questions, please:
- Check the Issues page
- Create a new issue with detailed information about the problem
- Include device information, Android version, and steps to reproduce
Note: Remember to replace yourusername with your actual GitHub username in the clone URL and issue links.