setScreenAwakeMode
Prevents the screen from automatically dimming and locking. Use this for features where the user needs the screen on without touching it — navigation maps, workout tracking, recipe reading.
Signature
import { setScreenAwakeMode } from '@apps-in-toss/web-framework';
declare function setScreenAwakeMode(options: {
enabled: boolean;
}): Promise<{ enabled: boolean }>;
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options.enabled | boolean | ✓ | true to prevent the screen from dimming; false to restore normal behavior. |
Returns
Promise<{ enabled: boolean }>— resolves with the currentenabledstate after the setting is applied.
Always release the lock
Screen-awake mode drains the battery quickly. Call setScreenAwakeMode({ enabled: false }) when the feature is done or the component unmounts. A useEffect cleanup is the right place.
Permission
No permission required.
Examples
Minimal
import { setScreenAwakeMode } from '@apps-in-toss/web-framework';
await setScreenAwakeMode({ enabled: true });
Realistic — navigation map screen
import { setScreenAwakeMode } from '@apps-in-toss/web-framework';
import { useEffect } from 'react';
export function NavigationMap() {
useEffect(() => {
// Keep the screen on while navigating.
setScreenAwakeMode({ enabled: true });
return () => {
// Release when leaving.
setScreenAwakeMode({ enabled: false });
};
}, []);
return <div>{/* Map component */}</div>;
}
Try it live
Open the Navigation page in sdk-example and run the setScreenAwakeMode card.
Related APIs
setDeviceOrientation— lock the screen orientation.setSecureScreen— block screen capture and recording.
Related guides
- Guides — Mini-app navigation flow patterns — mini-app entry/exit, opening external URLs, and screen-context (orientation, awake, secure) patterns.
External references
@apps-in-toss/web-framework— SDK package. The actual exports are re-exported from@apps-in-toss/web-bridge.- Web standard counterpart:
Screen Wake Lock API— a browser standard, but in-app webview support depends on the host app.