Description
To keep users informed of their latest GitHub notifications, background fetching must be supported. Android's WorkManager is a suitable choice for periodic background tasks that survive app restarts and comply with system constraints.
Proposed Solution
- Implement a
CoroutineWorker class (e.g., GitHubNotificationWorker) that:
- Periodically fetches data from the GitHub Notifications API (
https://api.github.com/notifications)
- Parses and filters new/unread notifications
- Triggers an Android system notification if new notifications are found
- Use
PeriodicWorkRequestBuilder to schedule the worker to run every 15 minutes.
- Use appropriate retry and backoff policies for network failure.
- Inject necessary dependencies (e.g., GitHub API service) via Hilt or another DI framework.
Additional Context
- Requires authenticated access to GitHub API using OAuth2 or Personal Access Token (PAT).
- Ensure background permissions and battery optimizations are handled gracefully.
- Consider using exponential backoff for reliability in unstable network conditions.