Added a check when publishing an event

no need to send the event if the screen is on