I am currently working on a Xamarin android app. What it does is grabs data from a website, parses it, and populates a SQLite database. This is all on button click though. What I would like to do is get rid of the button and have this run once a month as a background service.
I have already viewed the link below for creating them and looked at multiple other stackoverflow posts. https://developer.xamarin.com/guides/android/application_fundamentals/services/creating-a-service/
If someone could provide me an example of how this can be done it would be really appreciated. For this type of service I am thinking it would be best to use Started Services? If that is the correct way to go then how would I make sure the service would start and stop once a month. Or would the service continue to run but a method only be called once a month?
Edit: Okay so I finally found a basic structure for creating a Started Service in the link below. https://xamarinhelp.com/xamarin-background-tasks/
So the next step would be to figure out how to run the code within the StartCommandResult method only once a month. AlarmManager may seem to be the way to go?
Edit 2: So i have found the below link regarding AlarmManager, but for a week. Repeat Alarm once in a week in android
Now I would need to figure out how many days are in the current month and pass that into the setrepeating()?