im an amateur programmer and i need help, i want to make update location when i click my switch button and get the location send the address to the retrofit every 1 or 5 minutes. Most likely im gonna use the 1 minute first to test it and make textview to test it.
i already searching and copy-paste, testing many codes from the internet. But im confused, many of them either won't work when the screen off, expired, in kotlin or just sending notification once. Even one of them didn't get me the address to test it for textview in Main Activity. I also heard about the Android phone that won't allow your app to run in the background.
Then i heard about Work Manager from here: https://medium.com/@Lakshya_Punhani/background-services-running-forever-in-android-100261df88ee
But idk how to do it. Can anyone show the the simple but complete codes to do it, so i can call it from my Main Activity and will still running in the background unless i press again my switch button from main activity?