DEV Community

HarmonyOS
HarmonyOS

Posted on

[Sports Watch] [API 6] How to set a sports watch to keep the screen on continuously?

Read the original article:[Sports Watch] [API 6] How to set a sports watch to keep the screen on continuously?

Question: How to set a sports watch to keep the screen on continuously?

Short Answer:

onShow() {
    let that = this;
    // Set the screen to turn on every three minutes.
    that.setBrightnessKeepScreenOn();
    timer = setInterval(function () {
        console.log("Trigger the screen-on operation every 3 minutes.")
        that.setBrightnessKeepScreenOn();
    },3 * 60 * 1000);

},

setBrightnessKeepScreenOn() {
    brightness.setKeepScreenOn({
        keepScreenOn: true
    });
},
Enter fullscreen mode Exit fullscreen mode

Written by Jeorge Kiryienko

Top comments (0)