All days
Day 12Module 6 · Capstone· 6–8 hrs
Capstone II — Location, Weather API, Google Maps, Geofencing
Finish the capstone. Detect current location, pull weather from a REST API, embed Google Maps, and set up a geofence that fires a broadcast alert on entry.
0% done
Key concepts
- FusedLocationProviderClient
- Runtime location permissions
- REST call with Retrofit + coroutines
- SupportMapFragment & Marker
- GeofencingClient + GeofenceBroadcastReceiver
Lectures in this day
- 01
Weather Section Overview
Add a weather widget to the tour: 1) get the phone's location, 2) call OpenWeatherMap (a free weather API), 3) show temperature, humidity, and an icon. Use Retrofit (a networking library) with coroutines.
Real life · Peeking out the window before packing for a trip — 'do I bring an umbrella?' — right inside the app.Practice · 3 quick questions
Q1.Weather section adds…
Q2.Weather data comes from…
Q3.Networking library commonly used?
Pick one answer per question. - 02
Detect Current Location (I)
Add `ACCESS_FINE_LOCATION` to the manifest and ask the user for it at runtime with the Activity Result API. `FusedLocationProviderClient.lastLocation` gives a cached location fast — often good enough.
Real life · Asking a passerby 'roughly where are we?' — quick answer, maybe off by a block, but plenty for a weather lookup.kotlinval ask = registerForActivityResult( ActivityResultContracts.RequestPermission() ) { granted -> if (granted) fetchLocation() 0