We are designing an app that users use on a subscription basis. When the user pays for a particular period, a receipt is issued from our server valid for the duration. The app is designed to be used "offline", so it will only be connecting with the internet to get the receipt from the server.
When in "offline" mode, the app waits for the paid duration #-of days until it requires the user to pay again. We are having problems implementing this.
We first tried to use an always running background service. But after reading http://stackoverflow.com/a/2682130/5753416, http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/, we decided to use AlarmManger to schedule periodic alarms to check for the payment.
We are now facing problems with the alarm when the user changes the time/date. We are listening to Intent.ACTION_TIME_CHANGED and Intent.ACTION_DATE_CHANGED broadcast, but that isn't being broadcast when setting the date to the past.
My question is what is the right way of implementing a similar functionality. Any advice is appreciated.
issues with the broadcast
ASOP bug issue
There is one solution what you need to do is check phone up time so you can schedule alarm for some time like may be an hour or depending on your freq. So what you need to do is check phone uptime + duration for which the user is paid if that passes then cancel his subs. The only extra thing u need to check is if phone restarts once net should be connected to access your service.