Login to follow
WakeyWakey

WakeyWakey (ODC)

Stable version 1.0.0 (Compatible with ODC)
Uploaded on 10 October 2025 by Jasper Oudenaarden
WakeyWakey

WakeyWakey (ODC)

Details
Detailed Description

WakeyWakey: The OutSystems Wake Lock Component

A reusable JavaScript component for OutSystems that uses the [Screen Wake Lock API](https://developer.mozilla.org/en-US/docs/Web/API/WakeLock) to ensure that mobile device screens don't automatically turn off. Can be used in Web and PWA apps.


Features:

  • Activate Wake Lock - Keeps the screen active
  • Deactivate Wake Lock - Allows the screen to function normally again
  • Browser compatibility check - Checks if the API is supported
  • Status monitoring - Tracks the status of the Wake Lock
  • Automatic cleanup - Automatically deactivates on page unload
  • Error handling - Comprehensive error handling with specific error codes

Requirements:

  • HTTPS context - Wake Lock API only works in secure contexts
  • Modern browser - Support for Screen Wake Lock API
  • Mobile device - Works best on mobile devices
  • OutSystems - For use in OutSystems applications


Installation:

  1. Install Forge Plugin.
  2. Add Library components to your application.
  3. Use the client actions in your project!




Limitations

If your native app uses a modern WebView (e.g., Android System WebView 94+ or WKWebView on iOS 15+), you might be able to use this.

However:

  • It may not work reliably inside Cordova due to sandboxing or missing permissions.

  • You need to handle visibility changes manually (the wake lock may auto-release when the app goes to background).

So while the Web API can work in some modern environments, Cordova’s native plugin is far more reliable.

In native Cordova apps, the JavaScript Wakelock API (like navigator.wakeLock) is not natively supported in older WebViews.
Instead, you use a Cordova plugin that provides native access to Android’s or iOS’s power management APIs.

Common plugin:

cordova plugin add cordova-plugin-insomnia (Forge component available!)
MethodWorks in Cordova?Notes
cordova-plugin-insomniaBest and most reliable way
Web Wakelock API (navigator.wakeLock)⚠️ SometimesDepends on WebView version and permissions
Custom native pluginFor fine-grained control or CPU-only wakelocks