Multitasking: reacting to tv being switched on and off

Hello,
I have problems with reacting to tizen tvs being switched on and off in my web application. I understand that the proper way to react to this kind of event is to listen for “visibilitychange” event and checking “document.hidden” property.
To my understanding I should get this kind of event only when tv is being switched on/off while my app is active or when my app is being sent to foreground/background by other app. It works as expected when bringing other apps to foreground, it also sends the event when you turn off the tv. Unfortunately I noticed that for Samsung Tizen 2016 and 2017 about 15s after I power off the tv, event “visibilitychange” occurs again and “document.hidden” is false, even though the screen is turned off. Switching the tv on after this happens does not trigger another “visibilitychange” event. For Tizen 2018, my app is killed about two minutes after tv went to standby, and is being killed and restarted every two minutes from this moment on. Background support is disabled in my app. I was able to reproduce this behavior on template web app by just adding “visibilitychange” listener that sends logs to server.
Why are my tvs behaving like that? What would be the proper way to react to tv being switched on? Any help would be appreciated.

1 Like

add <tizen:metadata key=“http://samsung.com/tv/metadata/multitasking.support” value=“true”/>
into your config.xml
[edit: reformatted to remove auto-link]