I am developing a Tizen .NET app for the Samsung Gear S3 (Tizen v4.0). I want my Wearable app (NOT a watchface) to always stay alive and never be put to sleep until the user exits the application.
I have made a small PowerManager that wraps the native dll:
[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);
enum Power_Type { CPU = 0, DISPLAY = 1, DISPLAY_DIM = 2 };
Here is what works:
If I call:
DevicePowerRequestLock((int)Power_Type.DISPLAY, 0);
Then my app does indeed stay focused but the display is always on. For now, I am managing myself what to show and I am manually coding the equivalent of the Ambient mode with timers. This is not ideal in terms of battery consumption.
Here is what does NOT work:
If I call:
DevicePowerRequestLock((int)Power_Type.CPU, 0);
or even if I call the Tizen .NET 4.0 call:
Tizen.System.Power.RequestCpuLock(0);
This does absolutely nothing. The screen goes out after the screen timeout (which is what I want) but if I wait long enough before I wake the screen up, the app is sleeping and I am back to my watchface.
So it seems to me the CPU lock is not working.
Furthermore, is there a way to know in a wearable app when Ambient Mode has been turned on to selectively display certain UI elements much like in a watchface?
Sorry if these are newbie questions but I cannot find the answer for this anywhere and I have a feeling I am not the only one with this problem.
Thanks!