Giter Site home page Giter Site logo

Geolocation working on android 13,14 even 8 but not on android 12 function does not call no error in console about cordova-plugin-geolocation HOT 11 OPEN

adeel399 avatar adeel399 commented on May 27, 2024
Geolocation working on android 13,14 even 8 but not on android 12 function does not call no error in console

from cordova-plugin-geolocation.

Comments (11)

adeel399 avatar adeel399 commented on May 27, 2024

i Forget to mention even in android 12 it asked for location permission every thing seems to be fine regarding permission

from cordova-plugin-geolocation.

breautek avatar breautek commented on May 27, 2024

Are you requesting FINE or COARSE location? (e.g. do you have high accuracy enabled or disabled?)

Android 12 has a known issue where requesting coarse location doesn't work as expected and instead location requests will timeout.

from cordova-plugin-geolocation.

adeel399 avatar adeel399 commented on May 27, 2024

const coordinates = await capacitorgeolocation.getCurrentPosition({
enableHighAccuracy: false,
});
right now my code
before i did not added any option (not working in 12)
then i added that option still not working

from cordova-plugin-geolocation.

adeel399 avatar adeel399 commented on May 27, 2024

My androidmanifest

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />
<uses-permission android:name="android.permission.INTERNET" />

from cordova-plugin-geolocation.

breautek avatar breautek commented on May 27, 2024

const coordinates = await capacitorgeolocation.getCurrentPosition({ enableHighAccuracy: false, }); right now my code before i did not added any option (not working in 12) then i added that option still not working

Sounds like you're hitting the android bug that I linked earlier. I think the only known workaround is to request high accuracy location (which translates to FINE location natively).

e.g.

const coordinates = await capacitorgeolocation.getCurrentPosition({
enableHighAccuracy: true,
});

When enableHighAccuracy is disabled, then COARSE location is used and location requests is suppose to report on location updates within 1,000km or so. The bug describes a situation where this doesn't work on Android 12. Having enableHighAccuracy enabled makes the underlying API to use FINE location instead which does work as intended on Android 12.

If you don't actually need FINE location, then perhaps it might be worth only enabling it on Android 12 devices.

This comment suggest that the issue is believed to be fixed but it will require an Android OS update and whether that update is available may be subjected to your carrier.

from cordova-plugin-geolocation.

adeel399 avatar adeel399 commented on May 27, 2024

So you suggesting enableHighAccuracy:true will resolve the issue on android 12?

from cordova-plugin-geolocation.

adeel399 avatar adeel399 commented on May 27, 2024

enableHighAccuracy:true
this does not fix the issue

from cordova-plugin-geolocation.

breautek avatar breautek commented on May 27, 2024

enableHighAccuracy:true this does not fix the issue

Can you confirm your device location settings?

Settings -> Location -> Location Services

Screenshot from 2024-02-14 14-33-14

Google Location Accuracy should be enabled, otherwise high accuracy / FINE location will not work.

Additionally, the app permission should have Precise enabled:

Settings -> Location -> App location permissions -> Your Application

Screenshot from 2024-02-14 14-35-08

Ensure location access is enabled with precise location.

If either precise location or Google Location Accuracy is disabled, then regardless of the app requesting high accuracy the device will only return COARSE location which will be a victim of the aforementioned android 12 bug.

The app permissions will be set by the user on the first time they use your app, but it's possible they disallow precise permission on the permission prompt which will trigger the android 12 bug. Google Location Accuracy is a user setting that can't be programmatically controlled, the user must enable it to enable high accuracy location. Usually it's enabled by default from factory.

from cordova-plugin-geolocation.

adeel399 avatar adeel399 commented on May 27, 2024

ok i ll update you regarding that tommorow

from cordova-plugin-geolocation.

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.