Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My experience with GPS is that it takes a while to get a fix (at least on my device), so I think you have to keep the phone from suspended state all the time. When I’ve been playing around with my device I’ve noticed that I have to use the built in music player to get a fix while the screen is off. As ratchetr pointed out PowerPolicyNotify(PPN_UNATTENDEDMODE,TRUE) seems to be the right way to prevent the "music player requirement".</p> <p>Edit: It also seems like you have to use SetPowerRequirement / ReleasePowerRequirement on some devices.</p> <p>Here is a C# sample:</p> <pre><code> 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); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload