I investigated and Although I read documentations of Huawei Wear Engine, I couldn't find any things. I knows this I should change power or keep-on setting but I did not find anthing. Even I know implementing a service to will affect system configuration but there is no any document about it. Could you help me about implement always keep on screen huawei GT2 Pro.
Asked
Active
Viewed 239 times
1

zhangxaochen
- 32,744
- 15
- 77
- 108

Deniz Babat
- 205
- 2
- 6
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Oct 06 '21 at 09:17
2 Answers
0
Keeping screen on could be achieved via brightness.setKeepScreenOn(OBJECT) https://developer.harmonyos.com/en/docs/documentation/doc-references/lite-wearable-system-screen-brightness-0000001122145264
Sample code is as follows:
brightness.setKeepScreenOn({ keepScreenOn: true, success: function () { console.log('handling set keep screen on success.') }, fail: function (data, code) { console.log('handling set keep screen on fail, code:' + code + ', data: ' + data); }, });

Zinna
- 1,947
- 2
- 5
- 20
0
As@Zinna mentioned, You can call brightness.setKeepScreenOn(OBJECT)
to always keep on the screen active.
Examples are as follows:
brightness.setKeepScreenOn({
keepScreenOn: true,
success: function () {
console.log('handling set keep screen on success.')
},
fail: function (data, code) {
console.log('handling set keep screen on fail, code:' + code + ', data: ' + data);
},
});
You are advised to invoke it in the onShow()
phase to always keep the screen on.
For details, kindly refer to this Docs.

zhangxaochen
- 32,744
- 15
- 77
- 108