davebythesea said:
Hi,
Thankyou both for your answers. It seems it might not be the best
approach then. The reason I was hoping to monitor for the device
turning off was - in my app I have an autosync routine which
periodically checks for new jobs etc.. using a web service. I
noticed that when the device turned off, if I then turned the device
back on, the app remains and all seems well but the sync did not
run. So I assume maybe the underlying GPRS connection is temporarily
turned off when the device turns off?
We have a similar application, and have not had a problem with GPRS
being unavailable if the device goes to sleep. We did find that the
standard timers didn't fire when the device was asleep, so we used the
LargeIntervalTimer from the OpenNetCF Smart Development Framework, and
it has worked well.
We do have to use the ConnectionManager to make sure GPRS is available
if it hasn't been used in awhile.
To figure out exactly what's failing, consider adding a little logging
to your app. For example, if you log an event when your timer fires,
and also log the status of bringing up the network connection, you
should be able to quickly tell where the problem is. Newer versions
of .NET CF have support for logging built in, but we started before
that and use log4net, which we have had good luck with.
I was just looking to maybe programtically turn off autosync if the
device was abouttop turn off, and turn on autosync once the device
turns back on. Still, its not giving me any problems as is, but
still, you like to think you have some control in a situation such
as this.
If the problem is that when the device wakes back up the autosync
doesn't work well, maybe it would be enough to detect when the device
wakes up and try to fix it from there.
Hope this helps,
----Scott.