Android Question How to get the location of the device

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I have been having a look around the forums and have seen different methods, some are out of date and it says not to use it. Some use GPS and some use FusedLocation.
What do you advise me that currently works?
Thank you very much.
 
Solution
For example, the one using this example
It is 14 years old.

I suggest to start with Erels GPS Tutorial

DonManfred

Expert
Licensed User
Longtime User
some are out of date and it says not to use it
Which ones?

Some use GPS and some use FusedLocation.
Both of them are actually WORKING.
Did you understand the difference between GPS and FLP?

Note that GPS may not work in buildings. And FLP may be not acurate.
 
Last edited:
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Which ones?
For example, the one using this example:
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
For example, the one using this example
It is 14 years old.

I suggest to start with Erels GPS Tutorial
 
Upvote 1
Solution

BlueVision

Well-Known Member
Licensed User
Longtime User
One more little hint (I'm not sure if this is addressed in more detail in the thread linked by Don Manfred):
Don't use the GPS library for satellite navigation with Android anymore. Replace the GPS library with the GNSS library. The old GPS library is no longer supported on newer Android devices. The replacement is relatively simple. Search the forum in this direction, there are several references to the GNSS library.
In principle, the GNSS library supports not only GPS but also other satellite systems such as GALILEO or GLONASS with the same range of functions. In this respect, it is an extension of the old GPS library.
 
Upvote 1

emexes

Expert
Licensed User
Longtime User
Some use GPS and some use FusedLocation.

Can you count on your users being willing to reposition themselves when the position is required, and they are outside of satellite view it no clear view of sky?

If you are receiving valid GPS/GNSS readings, then I'd go with that.

If not, then the fused location will use nearby cell tower, wifi and bluetooth to estimate a position, which might be accurate, or might not be. And if you're away from civilisation ie walking in bush, on a boat, etc, then there probably won't be nearby cell tower, wifi or bluetooth to estimate from. Although in that situation, the device probably won't have internet access too, in which case perhaps the question of position becomes moot.

So the answer to your question is: it depends on where the device is and why it needs to know where it is. Also: does it need to know where it is precisely, like within a few metres, or within a few tens of metres, or does it "just" need to know which country it's in? (which you'd think would be easy, but is less easy if reliability is a consideration, and especially if the user has incentive to appear like they're somewhere else, eg access to video streaming from another country)
 
Last edited:
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hello, users will be on roads leading to farms to take note of irrigation water consumption.
And I need to show them the route to find those water consumption meters.
Thank you.
 
Upvote 0
Top