Added classes to detect when the application is put in background or in foreground