Trigger events for closed, background, and foreground