Comments (8)
I'm having exact the same problem with the same versions on iOS. Same code on Android is working fine.
Did anyone find a solution for the problem?
from cordova-plugin-geolocation.
I've created a gist that covers the top reasons why you may not receive GPS results in a timely fashion which can be read here
Note that iOS on a cold-start will fire a few GPS points immediately regardless of how accurate or inaccurate the GPS points are, which explains "called 2-3 times."
from cordova-plugin-geolocation.
I have the same issue. Did anyone already find a solution or workaround for this?
from cordova-plugin-geolocation.
Couple of notes on why you may not be seeing gps updates
- You're in a poor environment, such as in a large office building or basement.
- Ios implements a distance filter, which I believe Cordova hardcodes to 5 meters when in high accuracy mode (10 meters otherwise if memory serves me right). Therefore you have to be actually moving to receive gps updates, at least 5-10 meters approximately before ios will propagate gps events.
from cordova-plugin-geolocation.
Thanks for your fast response. I checked both of your points. But unfortunately it still wont work. I tested it on both iPhone and iPad with iOS 13.3.
It seems like iOS stops updating the geolocation after 2-5 seconds. Also the status bar GPS symbol disappears after a few seconds.
On the xCode simulator everything works perfectly fine.
from cordova-plugin-geolocation.
The described behaviour really sounds like an environmental issue.
But here is a couple more tips...
I don't access to an iOS device at this moment, and I'm not very familiar with the iOS location settings, but ensure that high accuracy is enabled, or that wifi/cell towers for location tracking is enabled. Anything that is "GPS Only" will take a very long time for devices to obtain a satellite fix (Generally this takes 10-15 minutes from a cold start). This is unfortunately a phone setting, not an app setting, so if this solves the problem, then there is very little you can do other than give appropriate error feedback to the user.
Another thing you can try is to remove the distance filter. I would recommend doing this only to ensure that you're not getting gps points filtered while debugging. It isn't recommended to keep it like this for most applications because it will cause battery drain, but might aid in debugging.
You can temporarily modify this line to ensure that GPS isn't being filtered by distance travelled. Set distanceFilter
to kCLDistanceFilterNone
to disable the filter, so events will be triggered even if the user hasn't moved a significant distance.
Lastly, if the issue persists, I would recommend creating a basic barebones sample app with the minimum requirements to reproduce the issue. So for example, a pure cordova with only the cordova-plugin-geolocation
installed, but not ionic, or any other framework. This is to help isolate the issue away from frameworks and prove that the issue lies inside Cordova, and will also provide us an usable test case that can be used when applying patches.
from cordova-plugin-geolocation.
I can confirm @breautek 's comment. The problem you are likely experiencing is the distanceFilter. If you move less than 5 meters, you won't get an update. While this is probably great for driving apps, for apps on foot where you're trying to store a reasonably precise point it won't really work for you. I imagine the people reporting this are not moving far when reporting "it stops after 2-5 seconds", this is the time when the GPS is locating you and precision is increasing. Once it has good precision, you won't get more updates until you move more than 5 meters.
Fixing the line as he says resolves the problem. You can put 0
or kCLDistanceFilterNone
. You'll get updates, in my testing, if the device moves even half a foot.
from cordova-plugin-geolocation.
Closing as stale
from cordova-plugin-geolocation.
Related Issues (20)
- geoocation not returning anything when device has no internet connection HOT 1
- 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
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.