Comments (13)
is there any update here? i have exactly the same issue in my application.
from cordova-plugin-geolocation.
Sure thing,
https://github.com/Danbardo/cordova_geolocation_bug
from cordova-plugin-geolocation.
What platform?
from cordova-plugin-geolocation.
Sorry, Andoid 8.0.0.
Haven't tested on iOS yet.
from cordova-plugin-geolocation.
Is this consistent on other Android versions as well?
Can it be reproduced in an emulator?
from cordova-plugin-geolocation.
I have reproduced the problem with an older device which is using 5.0.1.
Unfortunately I can't isolate the problem.
I have rebuilt the project several times and the new projects never exhibit the same behavior. Everything between projects is identical, I am not sure why the original project is causing the issue.
from cordova-plugin-geolocation.
(Anecdotally I have read/heard multiple times that geolocation is fishy when the app is started without the permissions and only then added - but afaik nobody was ever able to give a good reproduction case :( )
from cordova-plugin-geolocation.
This issue is frequently occuring for me now, I am not sure why, but now I can't get fix it, here are the steps I take to reproduce it:
cordova create test --id "com.test.test" --name "test"
cd test
cordova plugin add cordova-plugin-geolocation
Delete everything in the init.js and replace with:
document.addEventListener("deviceready",function(){
getGps();
},false);
function getGps(){
navigator.geolocation.getCurrentPosition(gpsSuccess, gpsError,{timeout:5000,maximumAge:10000,enableHighAccuracy:true});
}
function gpsSuccess(position) {
alert('Success');
}
function gpsError(error) {
alert('GPS Error: code: '+error.code+'\n'+'message:'+error.message+'\n');
getGps();
}
cordova platform add [email protected]
cordova run android
Turn Location on before running the application, you will see it works.
Exit the application.
Turn Location off.
Re-enter the application.
Wait for the timeout alert.
Turn Location on.
Notice that the application never accesses the location.
Tested on Android 8.0.0 and 5.0.1
from cordova-plugin-geolocation.
Turn Location on.
Notice that the application never accesses the location.
Do you restart the app in between those steps or call getGps
manually somehow? Otherwise that doesn't look to wrong from what you wrote - deviceready
won't fire again after turning location on I guess?
from cordova-plugin-geolocation.
Nah, I don't leave the app. The getGps() is called every time the request times out. So every time you see the error alert, it should run the getGps() function again.
Am I wrong about that? I think it works because I see errors every 5 seconds.
Thanks for editing my post :)
from cordova-plugin-geolocation.
Ah, I missed the getGPS()
in the error handler.
Could you upload that project to Github so a developer just has to clone that instead of doing those steps manually?
from cordova-plugin-geolocation.
I've never encountered this issue myself, but considering that we do not actually have any geolocation implementation for android (the plugin just handles declaring capabilities and permissions)... it sounds like an issue with the chrome webview.
from cordova-plugin-geolocation.
Closing as stale.
from cordova-plugin-geolocation.
Related Issues (20)
- iOS 14: Infinite value in returned location data causes app crash HOT 2
- Geolocation getcurrent position passing 0 (Time out error) HOT 5
- !important Android 12 new approximate location and precise location HOT 4
- IOS 15 Geolocation permission message issue. HOT 12
- iOS 15 - ionic app geolocation permission prompt message showing ionic://localhost HOT 2
- geolocation plugin is throwing an error on location request on electron (windows) platform
- [iOS] Location update are disabled after one kCLErrorLocationUnknown HOT 6
- Ionic - Position error:application does not have sufficient geolocation permission HOT 2
- GeoLocation permissions not being asked [SOLUTION] HOT 1
- [iOS permission bug] wrong logic in didChangeAuthorizationStatus hook, permission can be asked in some unexpected cases HOT 10
- [question android api 31 32] approximate access to geolocation for getCurrentLocation HOT 6
- Unable to fetch Location on VIVO Devices HOT 70
- iOS 16 CDVLocation.m throwing UI unresponsiveness warning in XCode - causing app to crash. HOT 7
- Next version release HOT 2
- Description String override in android as in iOS HOT 4
- this.geolocation.clearWatch is not a function HOT 1
- Android 33 issue when initializing HOT 3
- Geolocation working on android 13,14 even 8 but not on android 12 function does not call no error in console HOT 11
- Heading is set to NaN if speed is 0 or null. HOT 1
- Infinite loop onPause() -> onResume() HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-geolocation.