Code Monkey home page Code Monkey logo

Comments (3)

ocram avatar ocram commented on June 14, 2024

Thanks for your excellent description of the problem and what you have done!

So you’re saying it doesn’t work on a Pixel 3 with Android 10, but it does work on an emulator with Android 10, right? (Since API level 29 is Android 10, isn’t it?)

First, could you try using a longer interval, such as 1000 * 15 (15 seconds) and see if that changes anything? You definitely don’t need to wait for 5 minutes then. A location update should be available within a minute.

Second, does it make any difference whether you are outside (perhaps with a clear view of the sky) or inside (a larger building)? Other apps could be relying on Wi-Fi location here while you are explicitly requesting a GPS location with the constructor arguments.

Third, are you running the app in the foreground or in the background while testing this? At least with Android 10, this really makes a difference. You may even have to request the android.permission.ACCESS_BACKGROUND_LOCATION permission if running in the background.

from android-simplelocation.

okynk avatar okynk commented on June 14, 2024

@ocram
Thank you for your help! Your second statement solved the issue.
After I changed the requireFine to false, it could get the lat & long.

Because I want to get the most accurate location of the user, is it possible to get the "fine" location with automatic fallback to "coarse" location if can't get the "fine" location (or if get 0.0/0.0)?

from android-simplelocation.

ocram avatar ocram commented on June 14, 2024

That’s great to hear, thanks!

Currently, you can only use the “coarse” location with a fallback to the “fine” location, i.e. the other way round – in case the “coarse” location is not available.

The reason is that, when you want “fine” location, you usually want a guarantee that what you’re getting really has the accuracy you need. For example, if you’re working on turn-by-turn navigation, you rather want “no location available” than a location that is actually only Wi-Fi location and is of no real value to the use case at hand.

from android-simplelocation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.