Add flag for foreground vs. background for iOS