dimanche 19 avril 2015

Add a new row to SQLite database at a specified interval

I have a checkbook tracking application that allows to set an allowance and spending period for an account, for example $100/week, or $200/month.


I store the data in a table AccountSpendingPeriods like this:



| _id | account_id | start_date | end_date |


When the user creates an account, I use the current date as a start date and use their spending period to determine the end date. I am running into an issue trying to figure out how/when to add a new row to that table when a new spending period arises.


I looked into an AlarmManager, but I noticed in the documentation it only had intervals up to each day. I want the user to have spending periods for:



  • Weekly

  • BiWeekly

  • Monthly

  • Quarterly

  • Yearly


So depending on the spending period selected, I may need to update the database at different intervals. Is this possible with an AlarmManager? How can I handle the cases that exceed 14 days? A month cannot be considered as simply 30 days, because they are not consistent throughout the year.


Aucun commentaire:

Enregistrer un commentaire