Windows Mobile - Using Timer control
I need to call web service from windows mobile at perticular interval. Is Timer (System.Windows.Forms.Timer) the right control for this? Will this consume more battery power? Are the开发者_开发知识库re any alternatives?
If your device is expected to be in power on state, while the timer is running, then you can use the Timer control. If however, there is no user action for some period of time, the device will sleep and the timer won't fire. In order to save battery life, it is a good decision to allow the device to go on sleep state.
Have a look at the LargeIntervalTimer in OpenNetCF. This will wake the device from sleep state.
You P/Invoke the CeSetUserNotificationEx
native function with the dwType
field of the CE_NOTIFICATION_TRIGGER
structure set to CNT_TIME
and the stStartTime
field set to the moment in the future when you want to call the web service.
Either launch an app each time and let it die after the call, or have an app always alive in the background waiting for a named event being set by the notification subsystem.
精彩评论