LocationTracker
An example that shows how to track location when app is in background. It tracks location using FusedLocationProvideClient
every 15 minutes when app in background and every 20 seconds in foreground.
When app goes in background we schedule a task using the setExactAndAllowWhileIdle
of AlarmManager
that launches a foreground service and saves received location to local database. App follows the Clean Architecture pattern.
The test folder contains a test of use case using the Spek framework.
Screenshots
App contains a screen with a map that shows the last saved location if it exist and it is not older than 1 hour. It also request location updates and moves a marker according to updates.
App also contains a screen with a history of locations saved to database in background.