A Java based Android application which fetches real time weather forecast data from a weather api.
- Clone this repository to your local machine using 'git clone'.
- Open the project in Android Studio.
- Build and run the application on an Android device or emulator.
- The app will ask for location permission and will by default show the weather forcast for the user's current location.
- Tap on the search bar and enter the city your choice to see the custom city weather details.
- Go to the app's settings section to change the units of of temperature, wind, precipitation, visibility and pressure.
- Volley - for network requests
- Picasso - for image loading and caching
- Retrofit - a type-safe HTTP client for Android and Java.
Add the following permissions in your AndroidManifest.xml file.
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
You can add icons and fonts in the drawable file as per your choice. Or you can work with the icons and fonts given in this repository.
Refer to the XML file for the UI given here
- We are using Weather Api for this.
-
You need to signup and then you can find your API key under your account, and start using API right away!
-
Try the weather API by using interactive API Explorer or use Swagger Tool.
-
Alternatively you can find the SDK for popular framework/languages available on Github for quick integrations.
-
Refer to the documentations for the detailed steps here
-
Given below is the base URL used in the project
String url1="https://api.weatherapi.com/v1/forecast.json?key=<YOUR_KEY>&q="+cityName+"&days=15&aqi=yes&alerts=yes";
- Current temperature (current, min and max), feels-like temperature, rain chance, humidity, precipitation, wind speed, visibility, UV and pressure.
- Current weather condition (short and detailed).
- Weather condition icon.
- Hourly forecast for 24 hours.
- Daily forecast for 15 days.
- Sunrise and sunset time.