cbitstech / Purple-Robot

Sensing and automation platform for Android.
Other
38 stars 19 forks source link

Add flag to triggers to prevent triggers that would fire during device powered-off state from firing at power-on + PR startup. #227

Closed estory1 closed 10 years ago

estory1 commented 10 years ago

From a customer:

We have noticed one issue when the phone is turned off or dies. When it is turned back on, we are getting multiple audible and haptic alerts (and asked to complete the last missed medprompt), and then need to manually fire the triggers in order to receive any new prompts/EMAs.

The basic problem sequence is:

  1. Device powered off.
  2. Trigger(s) that would run, cannot, because the device is powered off.
  3. Device power on.
  4. PR runs the triggers that would have run in step 2.

Step 4 in that sequence is the issue.

Discussed solution: Add a flag to triggers that allows the developer/user to prevent this. The trigger runner would, for a trigger to be run, check whether it was supposed to run at a time occurring prior to the device's start time, and if the flag state disables execution, then the trigger does not run (else, it runs).