How to prevent turning screen off? (always on, turn screen on...)

Hi, this is almost one week of searching and trying without any result. What I need is simply. When you open my app and turn your wrisp away, normally the screen goes black or clock is shows up. I need keep this screen alive (on). Just like Samsung Health app (or every fitness app), when you want to run, you will start this app and when you running, this app is always ON. (so sensors are alive).

Please, can someone give me some hint? I found many topics on this problem, but almost every is for android mobile app not for wearable tizen / xamarin app.

For example: Turn screen on - #2 by SNS_1205 but I dont know, where I need to put this code.

   void MakeScreenOn()
   {
        int ret = DevicePowerRequestLock(1, 0); // type : CPU:0, DisplayNormal:1, DisplayDim:2

   }
   void MakeScreenOff()
   {
        int ret = DevicePowerReleaseLock(1); 
   }
    [DllImport("libcapi-system-device.so.0", EntryPoint = "device_power_request_lock", CallingConvention = CallingConvention.Cdecl)]
    internal static extern int DevicePowerRequestLock(int type, int timeout_ms);

    [DllImport("libcapi-system-device.so.0", EntryPoint = "device_power_release_lock", CallingConvention = CallingConvention.Cdecl)]
    internal static extern int DevicePowerReleaseLock(int type);

What’s this Code snippet about?

Have you been able to reach to a solution with the code you’ve pasted here?

yes, that’s right! :slight_smile:

1 Like