[solved] Getting the last known position from GPS
-
Hello,
I need the last known position from my GPS even if it is not turned on.
Viewranger is a program in which I can see my last known position even if the GPS receiver is turned off.
How to do so in QML, maybe with the PositionSource element ?
Thank you
-
You'll have to write some code to store your GPS fixes (either as they come in, or when your program exits) to a file, which you can then read in as your program starts next time. I'm not sure of a QML-native way to do this, but would be easy enough to do through a simple C++ class.
-
Your idea is, I think, the easiest and the one which is the least complicated.
I am not sure but I really think that these positions are already stored on my device.
In the example, I used Viewranger to see where I was when I turned off GPS but I don't remeber having run Viewranger when I turned GPS off. -
Ok, but then, with your solution, I always have to keep my program running in the background with a timer to cyclically write the GPS coordinates in the file if they are !==NaN.
Then I think of adding my program to the system startup, but how to do so ?
Maybe a new topic would be appropiate to ask this. -
My idea was running my app always in the background and saving the GPS's coordinates in a text file if they are valid (that's what I meant with "!== NaN").
This app should work as a "helper" app.Then when my actual program is run and not GPS is turned on, it checks the file and gets the position.
But I think you are right that running the program in the background might harm the battery.
-
Ok, then I know what to do. Thank you.