Networking & data
Retrofit/OkHttp in depth, serialization choices, Room, caching strategies and background work with WorkManager.
โฌโฌโฌโฌโฌ
1. Retrofit + OkHttp: structure, interceptors, error handling
networking
2. JSON serialization: Gson, Moshi, kotlinx.serialization
networking
3. Room & local storage: DataStore vs SharedPreferences
data
4. Caching & offline-first strategies
dataarchitecture
5. WorkManager & background work
background
๐ฏ Stage assignment
Stage project โ "an offline-first transaction feed" (4-5 hours).
Complete the previous stage's screen with a real data layer:
- Retrofit + OkHttp: an auth interceptor, logging (debug only), timeouts. Use a free API (httpbin, JSONPlaceholder) or a local mock server.
- Map errors into a
sealed interfaceresult โ notry/catchleft in the ViewModel. - Room: a
transactionstable, aFlow-returning DAO, the DB as single source of truth. refresh()fetches into the DB; the UI reads only the DB. Test it in airplane mode.- A "last updated" indicator + a
WorkManagerjob that refreshes when connectivity returns.
Done when: the list still appears after restarting with the network off, and refreshes itself once it is back.