• windows mobile 开发:让GPS一直在待机模式下也能运行


    最近,遇到一个需求,就是每 30 秒更新一次 GPS 位置,在测试过程中,发现在系统待机后,更新 GPS 位置就不能正常运行了,搜索后,发现如下的解决方案,实际应用了之后,有效,赞!!!

    http://stackoverflow.com/questions/873816/keep-windows-mobile-app-running-in-standby-mode

    public const int PPN_UNATTENDEDMODE = 0x0003; public const int POWER_NAME = 0x00000001; public const int POWER_FORCE = 0x00001000; [DllImport("coredll.dll")] public static extern bool PowerPolicyNotify(int dwMessage, bool dwData); [DllImport("coredll.dll", SetLastError = true)] public static extern IntPtr SetPowerRequirement(string pvDevice, CedevicePowerStateState deviceState, uint deviceFlags, string pvSystemState, ulong stateFlags); [DllImport("coredll.dll", SetLastError = true)] public static extern int ReleasePowerRequirement(IntPtr hPowerReq); public enum CedevicePowerStateState : int { PwrDeviceUnspecified = -1, D0 = 0, D1, D2, D3, D4, } // Keep the GPS and device alive: PowerPolicyNotify(PPN_UNATTENDEDMODE, true) IntPtr gpsPowerHandle = SetPowerRequirement("gpd0:", CedevicePowerStateState.D0, POWER_NAME | POWER_FORCE, null, 0); // Call before exiting your app: ReleasePowerRequirement(gpsPowerHandle); PowerPolicyNotify(PPN_UNATTENDEDMODE, false);
  • 相关阅读:
    python函数内容
    python读写csv文件
    python正则表达式
    python使用MYSQL数据库
    python简单面试题
    python执行cmd命令
    python详解json模块
    我的自动化测试之路
    测试开发这一年
    招聘测试人员,我在面试什么?
  • 原文地址:https://www.cnblogs.com/todd/p/3460517.html
Copyright © 2020-2023  润新知