I'm trying to make an Android app that gets (and saves) GPS coordinates every time a questionnaire form on the app is completed and the Save button is pressed (noting the GPS location part is not shown). Minimum device platform requirement is Oreo 8.1 (API level 27).
I have looked up two location-samples available from Android's Github:
But on Android's Site, in Services, it says:
In most situations, for example, you shouldn't access location information from the background. Instead, schedule tasks using WorkManager.
Should I go for the 'Foreground' sample's approach?
(Also, in the README.md file, for the above mentioned github-location-samples, it lists 'Basic Location' samples (in Java and Kotlin) but the links take you to no resource/code.)
Can you kindly guide me on which approach to take?