Android Question Location Manager and 3G

Discussion in 'Android Questions' started by mark35at, May 5, 2015.

  1. mark35at

    mark35at Well-Known Member Licensed 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?
  2. warwound

    warwound Expert Licensed 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.
  3. mark35at

    mark35at Well-Known Member Licensed 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: May 5, 2015
  4. warwound

    warwound Expert Licensed 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.

    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).
    mark35at likes this.
  5. mark35at

    mark35at Well-Known Member Licensed User

    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.

    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!
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice