For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/js-api/device/screen/setKeepScreenOn.md.

setKeepScreenOn

设置屏幕常亮状态。

扫码预览

扫码预览 setKeepScreenOn

支持版本

前端库版本不低于 0.0.25。

支持平台

平台支持情况
Android支持
iOS支持
PC不支持
HarmonyOS不支持

支持场景

场景支持情况
页面支持
卡片不支持

使用说明

  • 不再需要常亮时应主动将 keepScreenOn 设为 false,避免额外功耗

调用方式

异步 API

setKeepScreenOn(params: SetKeepScreenOnParams): Promise<object>

入参

名称类型必填默认值约束说明
keepScreenOnboolean是--是否保持屏幕常亮。

调用示例

import { setKeepScreenOn } from '@doubao-dev/framework/api';

await setKeepScreenOn({ keepScreenOn: true });

成功返回

无返回字段。

返回示例

{}

错误处理

错误对象和通用错误码见 通用错误处理。

错误码

通用错误码

errNoerrMsg说明平台
102internal error内部错误Android

平台差异

  • iOS:页面销毁后常亮状态会自动恢复
  • iOS:设置常亮恒返回成功,无失败错误码