added alert when the app is in the foreground