Android Question Get coordinates from GPS

Sergey_New

Well-Known Member
Licensed User
Longtime User
Please tell me if it is possible to get coordinates of the current position using the GPS library. No map required, only coordinates.
 

TILogistic

Expert
Licensed User
Longtime User
Yes,
 
Upvote 0

emexes

Expert
Licensed User
Longtime User
Most GPS chips also measure speed directly, via Doppler shift, which is more accurate than taking two positions and dividing distance between them by time.

Which reminds me:

Charles Doppler had five children; what were they called?

Dopplegangers.

What do you call a guy who's been hit in the head with a shovel?

Doug.

What do you call a guy with 50 rabbits up his bum?

Warren.
 
Last edited:
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Thank you!
The time to receive coordinates with the GNSS library is more than 10 seconds.
When using the GoogleMap library, this time is about 1 second.
Is there anything that can be done to reduce the time?
 
Upvote 0

Serge Bertet

Active Member
Licensed User
Longtime User
Make sure you are testing outdoor, you could get better results.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
keep in mind that, as developers, we can only use "open" satellite constellations, slower, less accurate (typically <1m, while Digital Giants, like google, have access to faster and more accurate Satellites, with accuracies of less than 10cm at times.
What you can do, is use the GoogleMap lib without showing the actual map, and just extracting the info you need.
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Cableguy, that's what I do. But unfortunately, even though the GoogleMap key is free, it's tied to my debit card, which is about to expire. It's not possible to extend it in my country.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Cableguy, that's what I do. But unfortunately, even though the GoogleMap key is free, it's tied to my debit card, which is about to expire. It's not possible to extend it in my country.
yeap, that's google!
 
Upvote 0

emexes

Expert
Licensed User
Longtime User
under identical conditions

Simultaneously?

Or was one test done before the other?

The Google location is probably fused, eg starts off by using cell tower location, then to a wi-fi/Bluetooth estimate based on "visible" nearby devices of known position, and then finally to GPS after a time-to-first-fix period when it works out what satellites are visible and their precise orbital position, and aligns (correlates, synchronises) the ranging codes.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Consistently, immediately one after the other. Changed their sequence, the results are the same.
also keep in mind that google services are (may be) running in the background, so sat lock and other geo stuff are already available from those services to GMaps!
 
Upvote 0

emexes

Expert
Licensed User
Longtime User
Changed their sequence, the results are the same.

That is intriguing. Perhaps even a little worrying. 🫣

What if you move 50 metres between the tests. Does Google Map library immediately return the new location when you start it, or is it returning the last known location until the GPS chip "catches up"?
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
What if you move 50 metres between the tests.
I'll check and let you know. But I need a one-time and not very precise receipt of coordinates. Not required while moving.
 
Upvote 0

emexes

Expert
Licensed User
Longtime User
When using the GoogleMap library, this time is about 1 second.

I'm going to guess that it's something to do with this:

Cached Location Data: The library often retrieves the last known location from the device’s location cache, which is stored by the Android LocationManager or iOS Core Location. This cached data provides an immediate rough estimate of the location, reducing the wait time for a fresh GPS fix.

sounds right, but not yet verified outside of AI, which has sometimes been known to just make sh*t up :rolleyes:

 
Upvote 0

emexes

Expert
Licensed User
Longtime User
But I need a one-time and not very precise receipt of coordinates.

My ex-wife is currently flying Australia to India. When she gets off the plane in Delhi, I would expect that for a few seconds to tens-of-seconds, her phone will be thousands of kilometres not very precise. Would your app be ok with that?

From a pragmatic perspective: if Google Maps library is providing the info you need, faster than a GNSS library that is only returning you real actual position fixes, and not interim best guesses or stale old positions, then can you just use that?

edit: still interested in your confirmation of whether or not Google Maps library is caching position and feeding you that when it starts up 🍻
 
Last edited:
Upvote 0
Top