[英]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. 我正在为WM6.5开发GPS追踪器,该追踪器可以使用GPS接收坐标并将其发送到。 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. 一切正常,但屏幕锁定时我遇到一个问题:正在发送数据包,但GPS无法正常工作(显示相同位置),但是当我唤醒手机后,GPS再次开始工作。
How can I can I keep the GPS service running when the screen is locked? 屏幕锁定时如何保持GPS服务运行? I'm testing with a HTC Touch 2 and my solution is written in C#. 我正在使用HTC Touch 2进行测试,而我的解决方案是用C#编写的。 For GPS i'm using the Microsoft.WindowsMobile.Samples.Location library. 对于GPS,我正在使用Microsoft.WindowsMobile.Samples.Location库。
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... Windows Mobile设备知道不同的电源状态。请参阅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 . 应用程序可以使用SetPowerRequirement API调用来请求特定的最小电源状态: http : //msdn.microsoft.com/zh-cn/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. 除了指定哪个设备不应低于电源要求之外,您还可以指定该应用程序的一般要求: http : //www.hjgode.de/wp/2009/07/14/howto-run-an-application-使用SetPowerRequirement和SetSystemPowerState 定期/#more-193 。
I recommend using SetSystemPowerState, if you want to avoid the device falls into a hibernate mode. 如果要避免设备陷入休眠模式,建议使用SetSystemPowerState。 If you know the GPS port and GUID, you can also use SetPowerRequirement with the device name. 如果您知道GPS端口和GUID,也可以将SetPowerRequirement与设备名称一起使用。
I have no experience with changing the Control\\Power branches to change the behaviour of a device within a named power state. 我没有更改Control \\ Power分支以更改命名电源状态下设备的行为的经验。
You may try SetSystemPowerState with Power_State_Unattended or enable the user to choose for 'keep device ON'. 您可以尝试使用Power_State_Unattended的SetSystemPowerState或使用户选择“将设备保持打开状态”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.