简体   繁体   中英

WM6.5 Lock screen turns off GPS service

I'm developing a GPS tracker For WM6.5 which can receive coordinates with GPS and send it into. All works fine but I have one problem when the screen is locked: packets are sending but GPS does not work (it shows same position) but when I wake up my phone then the GPS starts working again.

How can I can I keep the GPS service running when the screen is locked? I'm testing with a HTC Touch 2 and my solution is written in C#. For GPS i'm using the Microsoft.WindowsMobile.Samples.Location library.

This is probably because the device is going to sleep. If it stays awake, the battery will run down quickly. Mobile devices are designed to enter a hibernate like state almost immediately so that they last longer on a charge.

If battery life is of no concern, you could go into the power settings and tell it to never turn off. However, you risk having a dead device if your battery ever runs out.

Windows Mobile devices know different power states.See HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Power...

An application can request a specific minimum power state using SetPowerRequirement API call: http://msdn.microsoft.com/en-us/library/ms920689.aspx . Instead of specifying which device should not fall below a power reqirement, you can also specify a general requirement for the application: http://www.hjgode.de/wp/2009/07/14/howto-run-an-application-periodically/#more-193 using SetPowerRequirement and SetSystemPowerState.

I recommend using SetSystemPowerState, if you want to avoid the device falls into a hibernate mode. If you know the GPS port and GUID, you can also use SetPowerRequirement with the device name.

I have no experience with changing the Control\\Power branches to change the behaviour of a device within a named power state.

You may try SetSystemPowerState with Power_State_Unattended or enable the user to choose for 'keep device ON'.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM