I'm writing a Pet game for my kids and I need to be able to have things be monitored even when the kids are not using the app. Things like the pets hunger level and maybe even have a notification sent to the phone when pet is hungry. Can someone steer me n the right direction to find out how to do what I need?
You could just create one file that contain millis from everything you want to track and one timer that reads the file for example in 1 minute intervals.
If Datetime.Now is more than you have set into file then you can take proper action and update new millis into file.
You can declare timer from Starter service, so it shouldn't get killed. It only matters if you want to create notifications from background.
When everything is stored to the file you can easily read the file next time when app is opened and calculate how much time has passed from last actions.