add support for new foreground API