Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

How detect in BrightScript when Screensaver is shown?

How detect in app when Screensaver is shown ?
How detect when screensaver was hidden?
0 Kudos
8 Replies
EnTerr
Level 8

Re: How detect in BrightScript when Screensaver is shown?

describe your use-case in more detail please. E.g. my channel does this and this - and i have (don't have) private screensaver as part of it etc etc
0 Kudos
destruk
Level 10

Re: How detect in BrightScript when Screensaver is shown?

Here is a simple use case - we want to track how many users are logged into the channel for months or years at a time without logging out.  We're also interested in market research to find out what percentage of users have disabled the screensaver vs what percentage have it set to 10 minutes or longer without pinging their roku or unnecessarily hitting our servers to collect this information.  If the screensaver is on and the roku channel app displays a dialog box the screensaver doesn't turn off unless the user does something on the remote.  More hard data about screensavers wouldn't be a bad thing would it?
0 Kudos
EnTerr
Level 8

Re: How detect in BrightScript when Screensaver is shown?

"destruk" wrote:
Here is a simple use case - we want to track how many users are logged into the channel for months or years at a time without logging out.

Isn't there some timer that kicks out of the channel and to Home screen if it has been inactive for couple of hours or some such? That would make the answer 0 users Smiley Happy

 We're also interested in market research to find out what percentage of users have disabled the screensaver vs what percentage have it set to 10 minutes or longer without pinging their roku or unnecessarily hitting our servers to collect this information.  If the screensaver is on and the roku channel app displays a dialog box the screensaver doesn't turn off unless the user does something on the remote.  More hard data about screensavers wouldn't be a bad thing would it?

In a perfect world, ask a Roku rep and they may tell you that. Or, the answer may be "nunya business" - in which case that won't be doable via API either Smiley Happy. But, hmm - have you tried ECP /query/active-app ? It's been documented for almost a year, without a drumroll.
0 Kudos
belltown
Level 7

Re: How detect in BrightScript when Screensaver is shown?

ifAppManager.GetScreensaverTimeout() will tell you what the user's screensaver wait time is set to, zero if it's disabled.

ifAppManager.UpdateLastKeyPressTime() can be used to prevent the channel returning to the Home screen (ever), allowing the channel to run for many years continuously.

In Scene Graph applications, I believe the render thread does not run while the screensaver is active, so if you have a way for the render thread to communicate with a Task thread, which will continue running while the screensaver is running, you might be able to determine in your Task whether the screensaver is running or not, by the absence of such communication.
https://github.com/belltown/
0 Kudos
destruk
Level 10

Re: How detect in BrightScript when Screensaver is shown?

Thanks guys.
0 Kudos

Re: How detect in BrightScript when Screensaver is shown?

Are there any events that can be triggered when the screensaver comes on?
0 Kudos
belltown
Level 7

Re: How detect in BrightScript when Screensaver is shown?

"Aleksandr_Sam" wrote:
Are there any events that can be triggered when the screensaver comes on?

Only when the screensaver exits. There's an roDeviceInfoEvent generated:

https://sdkdocs.roku.com/display/sdkdoc/ifDeviceInfo#ifDeviceInfo-EnableScreensaverExitedEvent(enabl...
https://github.com/belltown/
0 Kudos
tutash
Level 7

Re: How detect in BrightScript when Screensaver is shown?

Yeah. There's a way to figure this out. Knowing how long to wait and knowing when to start waiting kinda gives you the answer.
0 Kudos