Welcome to the Weather App! This Android application provides accurate and up-to-date weather forecasts for any city in the world. The app uses data from the WeatherAPI to provide a 24-hour weather forecast for a selected city, with the background image changing dynamically based on whether it is day or night in that location. Additionally, the app now includes functionality to request location permission from the user and guide them to enable location services. Once location services are successfully enabled, the app will automatically display the weather for the user's current city.
-
Current Location Support: The app can request location permission and prompt users to turn on location services, allowing the app to display the weather for the user’s current city.
-
Search by City: Users can search for any city by name to get the current weather and a 24-hour forecast.
-
24-Hour Forecast: Detailed weather information for the next 24 hours, including temperature, humidity, wind speed, and more.
-
Dynamic Background: The background image changes to reflect day or night based on the selected city's local time.
-
User-Friendly Interface: Simple and intuitive design for a seamless user experience.
Screenrecorder-2024-09-14-20-19-52-466.mp4
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
- Android Studio
- A device or emulator running Android 7.1 (Nougat) or higher
- An API key from WeatherAPI
-
Clone the repository:
git clone https://github.com/aaimran236/Weather-App
-
Open the project in Android Studio:
- Launch Android Studio.
- Select "Open an existing Android Studio project".
- Navigate to the directory where you cloned the repository and select it.
-
Add your WeatherAPI key:
-
Obtain a free API key from WeatherAPI.
-
In Android Studio, open
gradle.properties
file (or create it if it does not exist). -
Add your API key like this:
WEATHER_API_KEY=your_api_key_here
-
-
Build and run the project:
- Connect your Android device or start an emulator.
- Click the "Run" button in Android Studio.
- Launch the app on your device.
- Grant location permission when prompted and enable location services if necessary.
- The app will automatically display the weather for your current location.
- Alternatively, you can enter the name of a city in the search bar.
- View the current weather and the 24-hour forecast for the selected or detected city.
- Notice the background image changing based on whether it is day or night in the city.
- WeatherAPI - The API used to fetch weather data
- Android Studio - The official IDE for Android development
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request
This project is licensed under the MIT License - see the (https://en.wikipedia.org/wiki/MIT_License#:~:text=The%20MIT%20License%20is%20a,therefore%20has%20high%20license%20compatibility.) for details.
- Thanks to WeatherAPI for providing the weather data.
- Inspiration and design ideas from various weather apps and tutorials.
Project Link: [https://github.com/aaimran236/Weather-App]