Languages

Menu
Sites
Language
How to know when system goes to sleep mode or awakes

Hello,

I'm developping a native service, no UI, and I'd like to know when the system goes to sleep mode, e.g. my service will be put to sleep, and when the system awakes, e.g. when the system awakes my service.

I did not find anything in the doc, is there some kond of callback function that is called when the system goes to sleep or awakes (like onPause and onResume on Android for example)? Or is there any other to catch such events?

Thanks.

Edited by: Fanny Huang on 02 May, 2017

Responses

1 Replies
Armaan-Ul- Islam

I haven't seen any API function to directly get the system state from service app yet. I would suggest you to use device_display_get_state() function to get current state of display which would give you the clue of system state. The display state would be:

 

DISPLAY_STATE_NORMAL 

Normal state

DISPLAY_STATE_SCREEN_DIM 

Screen dim state

DISPLAY_STATE_SCREEN_OFF 

Screen off state

 

 

 

Include the header files:

#include <device/display.h>
#include <device/callback.h> 
And add the display privilege in manifest.
http://tizen.org/privilege/display