AdamBCo / PunctualTime

0 stars 0 forks source link

8) Background ETA processing #29

Closed nathanhosselton closed 9 years ago

nathanhosselton commented 9 years ago

As a user, I would like my leave time to provide the most up to date estimate even if app is "off".

nathanhosselton commented 9 years ago

Can we do this? Would this require a backend to process?

nathanhosselton commented 9 years ago

A silent push notification can be sent from an APS (Apple Push Service) server to 'wakeup' an app which is not running - provided the app was not killed by the user - and then execute arbitrary code in the background such as updating the travel time for an event.

nathanhosselton commented 9 years ago

CloudKit does not currently support push notification scheduling and is not an option as such. Parse may be used as an APS server and allows push scheduling but only up to two weeks in advance. This drawback could be mitigated slightly by simply waiting to schedule pushes on Parse until the two week window for an event is reached, but the app would have to be active within that two week period. Richmond created his own Rails server on Heroku to handle pushes using cron jobs and offered to assist us in setting up our own if needed. This might yield the most ideal results, but also potentially comes with the most overhead both in terms of upkeep and scaling.

nathanhosselton commented 9 years ago

At this point my recommendation for the service used to schedule remote push notifications is Parse. I would expect that the user subset which would not open the app for longer than two weeks but still rely on it would be a relatively small minority, and for those users local notifications would still fire. We could optionally inform the user in some way that they should keep the app open in the background in order to receive the most accurate notifications, but this could potentially violate an Apple Human Interface Guideline (research required).

nathanhosselton commented 9 years ago

Setting up pushes in Parse: https://parse.com/tutorials/ios-push-notifications

Scheduling pushes in Parse: https://www.parse.com/docs/push_guide#scheduled/REST

Pushes with categories in Parse: http://blog.parse.com/2014/09/15/ready-for-ios-8-so-is-parse-push/

nathanhosselton commented 9 years ago

Opted for local notifications after it was discovered that Parse scheduled notifications could not be deleted programmatically. Ability to update app in background retained.