diff --git a/bundles/org.openhab.ui/web/src/components/widgets/widget-foreground-service.js b/bundles/org.openhab.ui/web/src/components/widgets/widget-foreground-service.js index b50104b803..cd3d2bbe11 100644 --- a/bundles/org.openhab.ui/web/src/components/widgets/widget-foreground-service.js +++ b/bundles/org.openhab.ui/web/src/components/widgets/widget-foreground-service.js @@ -21,6 +21,14 @@ export default { this.$f7.on('pageAfterIn', this.onPageAfterIn) this.$f7.on('pageBeforeOut', this.onPageBeforeOut) + + document.addEventListener('visibilitychange', () => { + if (document.visibilityState === 'visible') { + this.startForegroundActivity() + } else if (document.visibilityState === 'hidden') { + this.stopForegroundActivity() + } + }) }, beforeDestroy () { this.$f7.off('pageAfterIn', this.onPageAfterIn)