Change power state level when app goes in background/foreground

Change power state level when app goes in background/foreground

BY 21 Jan 2016 Web Code Snippet
This code shows how to change power state level when app goes in background/foreground using visibilitychange event. When app in foreground and SCREEN_NORMAL state is requested, the device does not turn off screen automatically.
Written by