How to make a action for when phone screen turn's off?

I want to make the game pause when phone screen turn’s off

I guess it will take some javascript, eg Is it possible, in JavaScript, to detect when the screen is turned off in the Android & iOS browsers - Stack Overflow

1 Like