android checking if app has been opened multiple days in a row

Viewed 964

I am trying to implement a feature which detects if the user has been on the app for 2, 3, 4.... days in a row. I am trying to think about how this would work but I am struggling, hence I need help.

Originally, I thought about getting the date, adding that to an array and then checking the last few entries of the array were in a row. For example [28, 29, 30]. This would return a message of value saying the user had visited the app 3 days in a row. The issue with this is when I overlap and go into a new month. For example [38, 29, 30, 1]. My solution will no longer work.

I am looking for a solution which gets around this problem.

Thanks in advance.

2 Answers
Related