Reworked on alerting users when main activity is running in foreground