Give us feedback
Mobile icon

Screen Events Plugin

Stable version 1.0.4 (Compatible with OutSystems 11)
Uploaded on 27 April 2020 by 
 (2 ratings)

Screen Events Plugin

Trigger events based on your device's screen state! Enables you to fire an event whenever your user turns their device's screen on or off.
Read more

Ever needed to know if your user's phone screen is turning on or off? Look no further!

All you need to do is take the web block contained in this plugin and drop it anywhere you want screen event detection and event handler to live. This might be in your layout web block, or somewhere on a specific screen where you want to listen for those events. In my demo app, I have the block in the main screen.

Then, you just have two events to worry about: ScreenTurnedOff and ScreenTurnedOn. Those should be self-explanatory, and you can define event handlers for both.

Those events are fired the moment the screen state changes, so the logic contained in ScreenTurnedOff will begin to execute as soon as the screen turns off. How long long-running logic will continue to execute while the phone screen is off, and at what speed, I can't guarantee. Ditto for if your app goes to the background before the screen turns off. But in my simple tests in Android 9/10 and iOS 13, my Javacsript handler did capture a timestamp of the moment the screen was turned off in both use cases. However, your mileage may vary by exact device and operating system.

See the source at

Release notes (1.0.4)

Removed error that would get spammed if the plugin was not loaded correctly.

Reviews (1)
in version 1.0.4
best  explaining.