Android Question Location Manager and 3G

Mark Read

Well-Known Member
Licensed User
Longtime User
In order to save battery, I wanted to use the location manager and gsm triangulation to find my location. The code is working well and acquires a fix within 20 seconds which is fine. The only problem is the accuracy, I see 2375m always. Is there any way to get a better accuracy, maybe using a different library? Wifi will not be available where I am going and gps drains the battery too quickly.

Any ideas?
 

warwound

Expert
Licensed User
Longtime User
FusedLocationProvider is currently Google's recommended API for location listening.
But i'd assume it uses the same underlying technique as any other library for triangulation so doubt it will be any more accurate than your existing code.
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
If I understand this correctly, the FusedLocationProvider uses the gps library which means the gps must be active or not?

Update: Activating the wifi without connecting to any network seems to increase the accuracy to 31m which would be great. Why, I have no idea. Will try it tonight from another position.

Could this be due to the fine position?
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
FusedLocationProvider does not necessarily use the hardware GPS.

You set a location permission in your manifest and configure a LocationRequest's Priority - android uses these settings to decide how to get a location.
ACCESS_COARSE_LOCATION permission and PRIORITY_NO_POWER are i think the lowest accuracy settings available.

BUT you need to understand that the FusedLocationProvider fuses requests for locations from all applications on the device that use the FusedLocationProvider.
If application #1 requests maximum accuracy location from the FusedLocationProvider and then application #2 requests low accuracy location then the FusedLocationProvider can use the location that it has already got for application #1 and pass that location to application #2 - the location passed to application #2 will have some of it's accuracy removed but it will still be a 'recycled' location originally obtained for application #1.

Think of it as 'location caching' between applications that use the FusedLocationProvider.

Now that means that the location accuracy your application gets today could be different from the location accuracy it gets tomorrow.
If today a different app has already requested location from the FusedLocationProvider then the 'location cache' is fresh and available to your application.
If tomorrow no other app has already made any location requests to the FusedLocationProvider then the 'location cache' will be empty.

Activating the wifi without connecting to any network seems to increase the accuracy to 31m which would be great. Why, I have no idea.

I think that even though you are not connected to a wifi network, android can still obtain network based locations.
Being connected to a wifi network is not a requirement for network location to work - android just needs the MAC address of any nearby wifi signals and it can then look up those MAC addresses in it's database and get an approximate location.
(Again that's what i am assuming and cannot say it is fact).
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
I think that even though you are not connected to a wifi network, android can still obtain network based locations.
Being connected to a wifi network is not a requirement for network location to work - android just needs the MAC address of any nearby wifi signals and it can then look up those MAC addresses in it's database and get an approximate location.
(Again that's what i am assuming and cannot say it is fact).

You are correct, this is confirmed in goggles pages (PRIORITY_BALANCED_POWER_ACCURACY - here) . Wifi will give a location even if you are not connected. It triangulates the wifi signals surrounding you. Not much help for me when I sit in my canoe in the middle of nowhere.

Think of it as 'location caching' between applications that use the FusedLocationProvider.

This is no problem as I only use my own app for location.

Maybe I should go FusedLocationProvider and see what happens. My only concern is battery drain, otherwise I would use GPS but gps drains my battery in under 8 hours. Not good when you are a week in a canoe with no power!
 
Upvote 0
Top