I've been developing an application in .Net cf for WM5 in general.

One of the devices (in particular the HTC TyTN), doesn't seem to properly go to sleep. The screen goes off as normal, but my application keep making webrequests through GPRS as if the device did not go to sleep.

I was under the impression, that when the device goes to sleep, all threads pause. Then they continue when it wakes; I've seen this on a Dell x51v, and it works as normal.

So does HTC have something special set up on this phone It also has GPS and GPRS, which is different from the Dell (its a plain pda).

Now I could maybe catch this power event through API calls to create a message queue and request power notifications, but should I really need to do this It seems maybe I should disable whatever HTC is doing to keep the device awake somehow.

Any ideas

PS - Default options in settings are:

Battery Power: turn off after 1 minute

External: turn off after 2 minutes

Backlight is 1 min on both.

(the registry also reflects this)

Re: .NET Compact Framework Power Notifications for HTC TyTN


Anyone think the issue is different from what I'm thinking

Is it possible that the phone has 4 states rather than 3 as most pdas I've looked at:

  • Everything's on
  • Backlight goes off
  • Screen goes completely off, CPU still going (other pdas would halt the CPU)
  • All processes halted

And the fourth step would happen after some length of time if the screen is completely off.

Any help

Re: .NET Compact Framework Power Notifications for HTC TyTN


From your description the device seems to be in unattended mode when this occurs. Unattended mode is requested using PowerPolicyNotify call. It is used by AcitveSync (device is in unattended mode while a round of synchronization occurs), but might be also brought on by any other application. There might be something using GPS (a tracker) that would definitely employ unattended mode. As an application, you cannot fight this (and should not).

Re: .NET Compact Framework Power Notifications for HTC TyTN


I have timers that make webrequests throughout my app, and I need to pause these when the screen goes off in this case.

How can I get these events properly I tried using a message queue and requested power notifications for it through API calls, but it isn't reliable. For example, if you press the power button off and then on really quick, it doesn't work correctly. If you wait 5 seconds, it's fine.

Is there a way to just get the event of the power button press In the HardwareButton class

Or maybe a better way

Re: .NET Compact Framework Power Notifications for HTC TyTN


Could you elaborate what does "doesn't work correctly mean "

Also, what is the reason you insist on monitoring power Can't you simply do your webrequests whenever you are running (i.e. when the device is not suspended)

Re: .NET Compact Framework Power Notifications for HTC TyTN


My issue is telling when the device is suspended. (Sorry I've used terms for power and suspend interchangeably)

It doesn't work in that I don't get the "supposed" wake power event from the API call, I would post code, but it seems unnecessary since I want to do away with it.

In other words, I need 2 events: Suspend, and Wake. With my current method, wake does not fire if you hit the power button off and on really quickly, however suspend does fire in that case. If you press off wait a second or two, and then turn it on, it works.

So what is a better way to handle it