In my application (C#, .Net CE 3.5, WM 6.5), I have a thread that do sync with a web service. I want thread keep running if device goes to idle mode. So I use some Windows CE API, to run my thread in unattended mode and keep WiFi on during this process. (API from here). This works perfectly and system goes to standby instead suspend and thread run with WiFi is on. But 1 minute after standby, device goes to Suspend mode and execution stops.
Win32.CoreDLL.PowerPolicyNotify(Win32.PPNMessage.PPN_UNATTENDEDMODE, -1);
IntPtr wifiHabdle= Win32.CoreDLL.SetPowerRequirement(wifiDeviceName, CEDEVICE_POWER_STATE.D1, DevicePowerFlags.POWER_NAME | DevicePowerFlags.POWER_FORCE, IntPtr.Zero, 0);
//Connect to web service and do jobs ...
Win32.CoreDLL.ReleasePowerRequirement(wifiHabdle);
Win32.CoreDLL.PowerPolicyNotify(Win32.PPNMessage.PPN_UNATTENDEDMODE, 0);
When I change power configuration on device and set "Turn off screen if device not used for" to 2 minutes, unattended mode become 2 minutes before going to suspend. (strange relation). How can I force device to remain in Unattended mode
as long as I call PowerPolicyNotify(Win32.PPNMessage.PPN_UNATTENDEDMODE, 0)