Languages

Menu
Sites
Language
How to avoid device display going into sleep mode when your app is launched and there are no user interaction.

Hi,

Is there any api to stop the device lcd going into sleep mode.

The issue is such that the user won't be interacting with my app and the device lcd should not go into sleep mode after the lcd timeout is exceeded.

 

Thanks,

Anand

View Selected Answer

Responses

4 Replies
Mark as answer
Palitsyna

Hello,

you should add this line to your code:

    device_power_request_lock(POWER_LOCK_DISPLAY, 0);

For more information, visit this link:

https://developer.tizen.org/dev-guide/2.3.0/org.tizen.native.mobile.apireference/group__CAPI__SYSTEM__DEVICE__POWER__MODULE.html#ga87d358dabebb415e623498c5163503fb

 

Regards,

Svetlana Palitsyna

Anand Rudrakshi

Thanks. The issue is solved :)

Vikram

Hi,

Another way.

device_add_callback(DEVICE_CALLBACK_DISPLAY_STATE, display_changed_cb, NULL);

static void
display_changed_cb(device_callback_e type, void *value, void *user_data){
    int error;
    if(DEVICE_CALLBACK_DISPLAY_STATE == type) {
    	dlog_print(DLOG_INFO, LOG_TAG, "[device_changed_cb] display state: %d\n", (char*)value);
    	error = device_display_change_state(DISPLAY_STATE_NORMAL);
    	//error = device_power_wakeup(EINA_FALSE);
    }
}

 

Anand Rudrakshi

This is not the right way to do it. The display_changed_cb will be received only after the display state has changed either to "dim" or to "off" state.

If you change the state in the cb there will be flickering effect as the display goes off and on immediately.