This was unexpected...
I set up a Temporal BG service to run every 5 minutes to grab the Device Temperature.
Even before I hit START to begin an Activity on my EDGE... after less than 5 minutes, I'll have the Device's temperature. Great.
Then when I hit START to begin the activity, I still have access to DEVICE Temp, which updates every 5 minutes. Great.
However, if at some point I hit STOP, then RESUME the activity, I lose DEVICE Temp, and never get it back. This is not uncommon for users to use the stop/resume buttons.
As I understand it... tapping the STOP button triggers the onTimerStop() method. Then the onTimerResume() method upon resuming. Great.
But apparently tapping the STOP button ALSO triggers the onStop() method in Application.AppBase. This is where I had put this code in order to try to reap the background process so that it didn't continue to run on my EDGE device forever, as a zombie process, even if my data field wasn't running.
function onStop(state) { if (isBackground == true) { deleteTemporalEvent(); } }
Questions:
- Is reaping the process to prevent it from becoming an enduring zombie an issue? Or do these die when the device is powered off and back on?
- If so, how would I terminate the BG process at the activity end/save (not at a STOP, which can be resumed)?
Thanks!