Languages

Menu
Sites
Language
Trouble keeping Gear S2 display on

I'm working on writing a metronome app, using haptic feedback triggered by a timer to provide the pulses. Since normally the app pauses when the screen goes off, and as a result the timer stops, I'm trying to keep the screen on using a power lock. I've provided the power permission, and have this line of code when the metronome is started:

device_power_request_lock(POWER_LOCK_DISPLAY_DIM,0);

However, the display isn't staying on. It's not returning an error. It does cause the app to run in the background now, so the timer keeps triggering, but the timer loses accuracy while the display state is changing. What am I missing to actually keep the display on and dimmed?

View Selected Answer

Responses

2 Replies
Mark as answer
Nafisul Islam Kiron

First add privilege:

http://tizen.org/privilege/display

Add header:

#include <device/power.h>

Use:

result = device_power_request_lock(POWER_LOCK_DISPLAY, 0);

 

Hope that helps.

Brent Gerig

Thank you! I had forgotten to add the display privelege, despite that being documented in the API. (I had added the power privelege instead.)

In addition, for some reason using POWER_LOCK_DISPLAY_DIM does not dim the display, and also does not keep the display on when the watch detects the gesture to turn off the screen. Using POWER_LOCK_DISLAY does, however, keep the screen on no matter what. I suppose that in order to minimize power usage, I'll need to store the current brightness value, then manually set the display to a lower brightness, and restore it when done.