当设备进入关机模式时,gps会关闭 [英] gps turn of when device into the power off mode

查看:84
本文介绍了当设备进入关机模式时,gps会关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个可在HTC上获取GPS位置的应用程序.当设备进入关机模式时,GPS无法从任何卫星接收数据.

我该怎么办?

I am writing an app that get the GPS position on a HTC. When the device goes into power off mode, the GPS can`t receive data from any satellite.

What can i do??

推荐答案

当设备进入关机模式时,GPS将无法从任何卫星接收数据.

那是因为它处于关机模式.关闭电源意味着一切都已关闭.
"When the device goes into power off mode, the GPS can`t receive data from any satellite"

That''s because it''s in power-off mode. Power off means things are turned off. It''s by design.


再次感谢Joel Ivory Johnson



和解决方案.....

thanks again from Joel Ivory Johnson



and solution.....

Code Snippet
const string GPS_DEVICE_NAME_PATH = "DRIVERS\\Builtin\\GPSID";

public string GpsDeviceName

{

   get

   {

     if (_gpsDeviceName == null)

     {

       RegistryKey gpsInfoKey = Registry.LocalMachine.OpenSubKey(GPS_DEVICE_NAME_PATH);

       if (gpsInfoKey != null)

       {

         try

         {

           _gpsDeviceName = String.Format("{0}{1}:", gpsInfoKey.GetValue("Prefix"),    gpsInfoKey.GetValue("Index"));

         }

         catch { }

       }

     }

     return _gpsDeviceName;

   }

}



private void Form1_Load(object sender, EventArgs e)

{

   CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, -1);

   CoreDLL.GetDevicePower(GpsDeviceName, DevicePowerFlags.POWER_NAME, out currentPowerState);

   _gpsPowerRequirements = CoreDLL.SetPowerRequirement(GpsDeviceName, CEDEVICE_POWER_STATE.D0,  DevicePowerFlags.POWER_NAME, IntPtr.Zero, 0);



}

private void Form1_Closing(object sender, CancelEventArgs e)

{

   _gpsDevice.Close();

   CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, 0);

   CoreDLL.ReleasePowerRequirement(_gpsPowerRequirements);

}


我刚刚发现了解决此问题的方法!!

http://forum.trackr.nl/1211/ShowThread.aspx [
I just found out how to fix this issue!!

http://forum.trackr.nl/1211/ShowThread.aspx[^]


this work for kind of HTC device,
not work for my HTC(Touch2).....


but this a solution .

Enjoy it.. :(


这篇关于当设备进入关机模式时,gps会关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆