Assignment Project: Enhancing the Weather & User Profile App
In this assignment, students will enhance the **Weather & User Profile App** by adding new functionality and improving existing behavior.
1. Add Location-Based Weather Updates:
- Modify the weather feature to retrieve the user’s current location and fetch weather data based on that location.
- **Hint**: Use Android’s `LocationManager` or Google’s `FusedLocationProviderClient` for location access and pass coordinates to the weather API.
2. Add Profile Image Upload:
- Enable users to upload a profile picture using Firebase Storage.
- **Hint**: Allow users to select an image from their device, upload it to Firebase Storage, and store the URL in Firestore.
3. Implement Dark Mode:
- Add an option in the app’s settings to toggle between light and dark themes.
- **Hint**: Use Android’s theme settings to apply the dark mode UI across activities and fragments.
4. Improve Error Handling for API Requests:
- Enhance error handling by showing user-friendly messages if the API request fails (e.g., due to network issues).
- **Hint**: Use Retrofit’s `onFailure` callback to handle errors and display a `Toast` message or `Snackbar`.
- Add permissions for location in `AndroidManifest.xml`.
- Use `FusedLocationProviderClient` to get the location, then pass the coordinates to the weather API.
- Allow users to choose an image using an Intent.
- Upload the image to Firebase Storage and store the download URL in Firestore.
- Update the app theme to support dark mode in `styles.xml`.
- Use `AppCompatDelegate.setDefaultNightMode()` to toggle modes.
- Implement custom error messages in Retrofit’s `onFailure` and use a `Snackbar` for display.
This assignment will reinforce practical skills in Android development, enabling students to verify their work by comparing it with the provided solution.