yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Software Development] mligor:
It took me a while, but on the end I got it to work...

Point is that you have to use Unattended mode

here is what you have to do:

1) call PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE)

this will tell to PowerManager that your application wants to do something before device go to sleep :) - will activate Unattended mode

2) SetPowerRequirement(L"GPS0:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);

not sure if this is needed, but because we need GPS to stay alive it is ok to call it (if you use GPS over COM port, instead of GPS0: should be COMx:)

3) use RequestPowerNotifications(m_hMsgQueue, PBT_TRANSITION)

and create MessageQueue to get info when mode is changed... (look e.g. POWER_BROADCAST structure for more info).

4) you have to have one WaitForSingle/MultipleObjects with timeout, where you will wait for handle on MessageQueue you created for PBT_TRANSITION

5) when PBT_TRANSITION comes, and if device is changed in Unattended mode (simple string comparing POWER_BROADCAST.SystemPowerState=="unattended") you are responsible to keep device alive.. which mean you have to call periodically SystemIdleTimerReset() - if you do not do that, your device will go to sleep mode

do not call SystemIdleTimerReset() if you are not in unattended mode, because that will prevent device to switch off backlight and screen.

6) in case of timeout on WaitForXXObjects you can read GPS port and process your data

.. in general Unattended mode needs more power then sleep mode, but that is only way (at least on my HTC Artemis).

From documentation point of view simple call SetPowerRequirement(L"GPS0:", D0, POWER_NAME|POWER_FORCE, NULL, NULL) should be enough, but it is not so :(

I hope that will help you... my application works fine now and I'm happy :D

regards,

Igor
[Windows Mobile Software Development] dannyboy78:
Thanks for that Igor, that all works for me as well. Tested on HTC P3300 and HTC P3600. I have also tried this on the HTC TyTnII but that deviceas always doesn't want to play nicely, as Baffles pointed out it does indeed seem to ignore calls to SetPowerRequirement.

If anyone has come across a way getting round the problems of the TyTnII, it would be great to hear it.

Thanks

Dan
[Windows Mobile Software Development] negerzoen:
Unfortunately, I'm not able to keep the GPS signal alive on my HTC P3600 (Orange SPV M700). Unattended mode works; a timer remains active and a simpel counters counts through. However, the GPS signal disappears after pressing the power button.

I call PowerPolicyNotify and SystemIdleTimerReset on each timer tick. Then, I read all data from the serial port (COM9). This works fine. After I press the power button, there is no more data to read from the serial port.

I also tried the code Igor mentiones about the power notification. I had to use platform invokes because I'm using the .NET Compact Framework. This works; I receive a signal and I can read a message from the message queue. However, I don't see the entire point of creating a message queue en registering for power notifications. Is there anything you need to do on the transition event besides calling SystemIdleTimerReset periodically?

Please help me out!
[Windows Mobile Software Development] luleyp:
same problem on P3650

Hi there,

I have the same problem on the HTC Polaris (P3650). I want to run my application in unattended mode with an open gps connection.... and I haven'T found a solution yet.

Could anyone who managed to do that pleas post a code example for that.

Thanks a lot.

Patrick
[Windows Mobile Software Development] mligor:
Hi, sorry for late answer....

In transition event you just need SystemIdleTimerReset.. basically that is what unattended mode is:

In Unattended mode.. you get transition event PBT_TRANSITION, where SystemPowerState is "unattended", and application can decide if will allow device to go to sleep or to call SystemIdleTimerReset...

I'm not sure how long "unattended" PowerState stays... but if you call often SysteIdleTimerReset, your app could work without MessageQueue (anyway I use message queue for monitoring power state, and if power is to low, I switch off GPS device).
[Windows Mobile Software Development] mligor:
Just one more thing (or two)...

you read from COM9.. maybe you should try to call

SetPowerRequirement(L"COM9:", D0, POWER_NAME|POWER_FORCE, NULL, NULL);

in case that you press Power button.. device is going immediately into Unattended mode, and there is chance to miss that mode in case that you do not have MessageQueue, or maybe there is some kind of Windows optimization that if no applications are registered for PBT_TRANSITION, Unattended mode is skipped and device going immediately into Sleep.

You wrote that "there are no more data to read from COM port".. are you sure that your code is running?

in case that your code is still running, then you prevented Sleep mode, and you have to find correct call to SetPowerRequrement. But; if your code is stopped, then your device is sleeping, and you have missed Unattended mode.

I hope that will help a bit....
[Windows Mobile Software Development] fredcatsmommy:
for those of us that don't know anything about code, is this something that can be cabbed?
[Windows Mobile Software Development] mligor:
:) not really.. except that you want to have application which prevents your device to go into sleep mode...

Unfortunately I have not so much time to finish my application, but when that is finished.. I will post here link (and .cab) for sure...
[Windows Mobile Software Development] graememk:
Hi, been a member for a while and don't remember if i posted yet or not, I was coming up against this problem when developing a GPS application on a HTC TYTN2,

I wanted to constanty record the gps position, but not keep the screen on all the time,

I got around the sleep function of the device by not letting it into the suspend mode and keeping it in the unattended mode. this was done by calling:

PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE)

This put the lowest state the PPc could go into is the unattended mode but when it went into this mode the gps still turened off,

From reading an article on the code Project, : http://www.codeproject.com/KB/mobile/WiMoPower1.aspx i seen that different power levels ( i mean suspend etc here cant remember the poper term), turn off different applications and these are controlled via registry entries found here for the unatteneded mode :

HKEY_LOCAL_MACHINE\System\\CurrentControlSet\\Control\\Power\\State\\Unattended

the values that controls the GPS Intermediate Driver is "gpd0:" you change this to a 0 to keep GPS on in unatteneded mode, and 4 for it to be off in unattended mode,

I change it when my application starts and change it back when it finishes,
[Windows Mobile Software Development] 6ITdtvFQqY:
The GPS is kept alive using the "gpd0:" name, not "gps0:".

So, when your application starts call (C#):

public const int PPN_UNATTENDEDMODE = 0x0003;

public const int POWER_NAME = 0x00000001;

public const int POWER_FORCE = 0x00001000;

PowerPolicyNotify( PPN_UNATTENDEDMODE, 1 ); // For app.

IntPtr GpsPowerHandle = SetPowerRequirement( "gpd0:", PowerState.FULL /* 0 */, POWER_NAME | POWER_FORCE, IntPtr.Zero, 0 ); // For GPS.

When your application stops call:

ReleasePowerRequirement( GpsPowerHandle );

PowerPolicyNotify( PPN_UNATTENDEDMODE, 0 );

Nothing else is necessary. Works on my Polaris.

In the attached app, you need to set "MainForm.KeepGpsAlive = true"and "MainForm.LogGps = true" to see this logged in "\Application Data\GpsLoc".

(You can use the compiled exe but without keep alive and logging. It can be used to send the position through SMS and sync the time.)

George
[Windows Mobile Software Development] 6ITdtvFQqY:
This is an update of the code. The previous one was crashing sometimes because the GPS reported a (cached) solution but there were no satellites in the solution.

(The GPS stays alive so long as the application is running.)
[Windows Mobile Software Development] mligor:
it is possible that GPD0: works better then GPS0:

GPD is basically GPSID (GPS Intermediate Driver) - the one that use virtual COM port to connect to GPS driver and allow multiple applications to use GPS signal.

Also GPSOpenDevice open GPD not GPS, therefor it make sense to keep that driver alive, and it will (probably) keep real GPS driver ON.

Maybe that is a reason why my application didn't work 100% on my HTC diamond.... I'm going to try that :)
[Windows Mobile Software Development] NuShrike:
CamerAware Buddy uses GPD0 and works 100% on FUZE.

I use D1(one) state to keep power-drain at lowest possible. I don't use SystemIdleTimerReset(), yet.

For lowest possible power drain, it's best to go with a SiRFIII (or MK) chip-based external bluetooth puck. The Qualcomm GPSone is a huge, inefficient, power-drainer compared to BT+SiRFIII.
[Windows Mobile Software Development] mligor:
I have tried and using GPSID works great.

basically to keep GPS signal alive there are two possibilities (depends what you need):

1) in case that you want to keep LCD ON

- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)

- inform OS that your application needs Unattended mode (PowerPolicyNotify)

- register for PowerState notifications (RequestPowerNotifications)

- call SystemIdleTimerReset() often enough that LCD will not go OFF and/or device to go to sleep.

in this case when user Press Power button, your will get notification that device is going in Unattended mode, and you have to keep device alive with SystemIdleTimerReset() and to prevent never going in Sleep mode.

in this case user will be able to "switch off" device, but your application will continue running. You can also optimize application that in Unattended mode, nothing is updated on the screen, and less CPU to use (to save a bit battery)

2) in case that you do not want to keep LCD On all the time

- inform OS that you need always D0 state for GPD0: (SetPowerRequirement)

- inform OS that your application needs Unattended mode (PowerPolicyNotify)

- register for PowerState notifications (RequestPowerNotifications)

- but DO NOT call SystemIdleTimerReset() unless device is in Unattended mode

when user press Power button or device automatically switch off LCD after timeout, you will get notification about it and THEN call SystemIdleTimerReset to keep device alive. When device is again in ON mode, SystemIdleTimerReset should not be called.

This will ensure your application to work transparent, and it is perfect for some kind of GPS logger etc...

---

all this is very nice, and my GPS logger works perfect, BUT (arghhh!!) when I keep GPSID alive, power consumption is going to be very high (~150mA), and that is for my 900mAh battery a lot of power (max 6h)

What are your experience about power consumption of GPS? Can be that something else on my phone eat so much power or that is GPS chip?
[Windows Mobile Software Development] 6ITdtvFQqY:
GpsLoc has been updated into a full application.

See "Astrolabe - SMS your GPS position" at http://xdaforums.com/showthread.php?p=4037827

Tests showed that in auto power saving mode the battery (of a HTC Polaris, 1350 mAh) would be depleted in about 16 hours, if no GPS signal is available; if there is a GPS signal, the autonomy should be greatly increased (an informal test indicates more than twice the autonomy). Without power saving, the battery would be depleted in about 6 hours.

(Using GPS0 didn't keep the GPS on when my PDA was in standby mode. GPD0 did.)
[Windows Mobile Software Development] smuppy:
Mind telling us a litte more about that app, what is it? You got me all curious here ;)
[Windows Mobile Software Development] richardsoffice:
Keep GPS connected with LCD power off on HTC Diamond . . . will it ever be possible, and to have a CAB file to make it an easy install job? There is a great many owners out there who wish for just that you only have to look around other site forums.
[Windows Mobile Software Development] jirka25:
Yes Cab will be cool! :)

My problem is with the aplication OziExplorer.

Same problem as described here...

But on Samsung Omnia (WM 6.1) Oziexplorer keep gps always on, even if screen is lock. But now on my HTC HD2 (WM 6.5) gps off in standby :(

I think it is something else set in wm 6.1 vs wm 6.5... BUT WHAT IS IT?:(
[Windows Mobile Software Development] vphk:
The GPS Cycle computer(from the page about HTC Diamond) can read GPS data even you have Diamond in suspend mode. It is done by ticking "read data directly from the port" (or something similar).
[Windows Mobile Software Development] knox203:
I'm not sure if anyone has posted this but here we go anyways.

I had issues keeping GPS enabled when I'd put my Kaiser into suspend mode and found a fix. Just change the value for each of these registry keys to "1". Or just download the CAB I whipped up.

HKLM\System\CurrentControlSet\Control\State\Resuming\gpd0:
HKLM\System\CurrentControlSet\Control\State\Unattended\gpd0:
HKLM\System\CurrentControlSet\Control\State\Suspend\gpd0:

I believe this is a universal Windows Mobile fix and should work on any phone with a GPS chip. Don't quote me on that!!
[Windows Mobile Software Development] wg5566:
Thanks for this tip and cab, it works!

I've been doing this in another inconvenient way for years, I always need to use quickmenu or morttool to turn off the screen , when i using garmin que to record some track. otherwise the battery drains very fast. with your cab, just simply press the power button and the gps will keep working until i turn it off.
[Windows Mobile Software Development] CreepinJesus:
I've been looking around for ages for this fix.. though I'm not sure if it works just yet...

I applied the registry changes and rebooted the device (Blackstone). Using 'Trackr', I got a GPS signal and my position was fixed using 5-7 satellites. I turned off my device using the power button for about 10s, but when I turned it back on, Track went through "connecting to device", "gps ok", and finally "fix". However, it did do this very quickly, so did it actually disconnect?
[Windows Mobile Software Development] CreepinJesus:
It does actually work :) GPS Cycle Computer managed to keep tracking the route after I'd put the phone in standby.
[Windows Mobile Software Development] bluenote73:
This doesn't seem to work on my diamond, at least that I've been able to get working.

I had a slightly different reg key there, Power/state/etc,

and I tried gps0 gpd0 and NAV1 and none of them gave me the results I was expecting. Google Maps didn't update my location while the phone was off, and tomtom would seem to go through re-aquiring my location when it was turned on as well.

Any hints? Anyone using this on the diamond?
[Windows Mobile Software Development] CreepinJesus:
Have you definitely included the colon ':' after gpd0 etc?
[Windows Mobile Software Development] bluenote73:
Yep. I actually wrote a mort script to apply the settings (so I could make changes easily) and these were the values (which I checked manually as well).

RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\Resuming", "gpd0:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Unattended", "gpd0:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Suspend", "gpd0:", "1")
RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\Resuming", "gps0:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Unattended", "gps0:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Suspend", "gps0:", "1")
RegWriteDWord ("HKLM", "System\CurrentControlSet\Control\Power\State\Resuming", "NAV1:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Unattended", "NAV1:", "1")
RegWriteDword ("HKLM", "System\CurrentControlSet\Control\Power\State\Suspend", "NAV1:", "1")
[Windows Mobile Software Development] JANJANJAN:
Hi

For me (HTC HD2) it's working with the following parameters:

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\State\Resuming]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\State\Unattended]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Power\State\Suspend]
"gps0:"=dword:00000001
"gpd0:"=dword:00000001
"com4:"=dword:00000001

Regards JANJANJAN
[Windows Mobile Software Development] bluenote73:
Janjan,

I tried your settings but , disappointingly, they didn't seem to work for me.

Could you educate me a little bit, on your test method for this? And also how you decided to use com4?

My test was to load google maps, get a fix, suspend phone, wait, see if google maps latitude updates went through, and when phone turned on, to see if fix needed to be started again (it did). Then I repeated similar test with tom tom.

Any light you can shed would be great ..

thanks

Cory
[Windows Mobile Software Development] JANJANJAN:
Hi

you may be right with Google Maps. It seems to drop communication with GPS after you turn off the phone. But i guess this is a behavior of Google Maps and has nothing to do with the GPS itself. This even happens with power plugged in...

I am using OziExplorer for GPS-tracking. There you have an option to leave GPS activated even if the phone is turned off. However, without the described modifications, Ozi always lost communication with the GPS after turning off the phone. Now, GPS remains connected and the track is logged correctly...

BTW: Com4 is the port for communication with the GPS. You have to set this port in your Navigation apps (Google Maps has no such setting, maybe automatically or direct comm with the hardware?)

Regards

JANJANJAN
[Windows Mobile Software Development] knox203:
A good neutral way for you guys to test if this works is to use VisualGPS. Download it @ http://www.visualgps.net/VisualGPSce/Download/VisualGPSceInstall.CAB.

I've got this fix running on 250 devices including the AT&T Tilt, Fuze and Tilt 2. All are working great!
[Windows Mobile Software Development] flopyro:
these settings don't work on Samsung Omnia II, any ideeas how to solve the problem ?

i'm using IGO8...

Thank you !
[Windows Mobile Software Development] OASwan:
GPS loop does not work!

I wrote an app which collects GPS data and send them to a web server. It just spys for the device owner. The working loop is simple. Using CeSetUserNotificationEx I schedule setting named event at some time and wait using WaitForMultipleObjects. When the event is set I collect data using soft COM port and parsing NMEA strings. Before collecting I call PowerPolicyNotify(PPN_UNATTENDEMODE,0xFFFFFFFF), in collecting periodically call SystemIdleTimerReset(), on collecting call PowerPolicyNotify(PPN_UNATTENDEMODE,0). I don't call SetDevicePowerState, nevertheless everything functions OK ... for some time (about 10-20 hours). After that the loop stops. An event is scheduled but not set if a device sleep. If a device is turned on the loop is working again and after sleeping it fires several times and stops.

It looks like some resource leak occures in the app and/or OS. I tried to restart the app after several hours of work but it gave me no effect.

What could be the reason?
[Windows Mobile Software Development] bluenote73:
Someone posted an additional reg setting that ended up working for me, its applied to my phone (diamond) , but now I'm trying to find out what it was! Can anyone help?

thanks
[Windows Mobile Software Development] webabar:
HTC HD2 Rom Orange : works for me ! Thanx !!!
[Windows Mobile Software Development] JohnVanDeWaeter:
Hi all,

If these values are set in the registry, the gps-device is actually always ON I guess, no matter if it is used or not. Wouldn't that drain the battery?

Would it be better to set these values when needed and reset them (to zero I guess) when no longer needed?

tia!

John
[Windows Mobile Software Development] gadgetuk437:
You guess wrong

That IS what it does, try it.

HTH
[Windows Mobile Software Development] JVogler:
I have an old Kaiser I'm trying to accomplish the same thing on, but my registry doesn't not have the same 'tree' as this...are you using a custom ROM? I'm running WM6.1 official AT&T ROM. Everything is the same up until I get to the 'Control', then I have no option of 'State', just Keyboard Layout, Layouts, and Power. But, inside the 'Power' directory, there is a 'State' folder.

So if anyone runs into the same spot after 'Control' on their Kaiser, just choose 'Power' and continue on as posted. I'm sure if you've gotten that far into it, most would figure it out...just thought it could help out anyone getting stuck there.

I haven't gotten to try it out yet, but hopefully all is good, and I can actually suspend my phone while I'm logging my run tomorrow! Nothing is more irritating then when you finish your workout only to find out your GPS tracking program closed in your pocket 5 minutes in, because you couldn't turn off the screen or lock the keys! Thanks for posting your findings on this issue, I'm sure its an annoyance of a lot of people out there! XDA-Developers helps me out just about every day!
[Windows Mobile Software Development] JVogler:
Update: Worked just as I wanted, went from 90%-36% battery in about 3 hours though. You definitely couldn't use it to track your whole day. I'm going to try my 2800 mAh battery next weekend....hopefully will get about 7-8 hours out of it. Anyone know of any other registry settings I could adjust to save on battery? Maybe disable things that aren't absolutely necessary to running the GPS?
[Windows Mobile Software Development] guppiebugs:
p3600?

I would guess this should work on my P3600 but the GPD0 is nowhere to be found in the registry. Anybody? Thanks for checking anyway.
[HTC U Ultra Questions & Answers] Garkan:
Hello guys, i have a problem with my htc u ultra, i got an yellow stain on my display near the buttons and its a big one.

And as i am a lucky person, thr warranty dosent cover it as htc is known for.

So my question is, do you know a good/original screen replacement?(good price too, to be worth the repair)

https://m.imgur.com/a/81VVyxF
[HTC U Ultra Questions & Answers] Garkan:
Nothing? Nobody changed the screen? ?
[HTC U Ultra Questions & Answers] QDT:
Seems like none. It is quite uncommon phone so aftermarket parts will be really hard to get. (Plus the service will be a pain because back cover is glued and will surely crack while opening!)
[HTC U Ultra Questions & Answers] Garkan:
Nea, it wont crack, with a heat gun you can open it.

The problem is what screen is a good replacement
[LineageOS Questions & Answers] Robbo.5000:
Not long after LineageOS 15.1 became official on my OnePlus 3, whilst trying to find news on what has happened to Protected Apps, I managed to find an article with an interview with someone high up within the Lineage hierarchy. Unfortunately I've since forgotten which site this was on and have never found it again since. As part of the interview, the subject of Protected Apps was raised and what had happened to the feature.

It was confirmed that LineageOS are very much committed to Protected Apps and it will return some time in the future. The reason for the delay was that, at that time, no decision had been made on how it should be brought forward into 15.1. Since Trebuchet had been completely rewritten from scratch, Protected Apps needed some work done in order to be compatible within the new Trebuchet framework. This then led to the dilemma of whether they should just work on the existing code base for Protected Apps or to give it the same treatment of Trebuchet and give it a complete rewrite, so giving it some improvements and enhancements in the process.

Now, a couple of months or so down the line, I've not been able to find any information on the current state of play and was wondering if there's anyone from the LineageOS community who could provide some insight.

Has the decision now been made?

Is a solution now being actively worked on?

Can we get even a vague timescale (weeks, months, not until 16.x, etc.)?

Any information would be greatly received, thanks.
[LineageOS Questions & Answers] Robbo.5000:
I feel a bit like the teacher in Ferris Beuller.

Anyone? Anyone?