You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/02/08 14:55:59 UTC

[GitHub] [cordova-plugin-geolocation] junior-senior opened a new issue #221: GPS keeps timing out on iOS

junior-senior opened a new issue #221:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/221


   Hi all, 
   
   I've recently upgraded Ionic from 2 to 5 and for some reason this plugin always results in a GPS time out using watch position on iOS, however, it works without issue on Android. It has been tested on 3 different iOS devices and none work.
   
   `var watchOptions = {
                 timeout: 10000,
                 maximumAge: 3600,
                 enableHighAccuracy: highAccuracy 
               };
               this.geoWatch = this.geolocation.watchPosition(watchOptions)
                 .subscribe((data) => {
                   //console.log(data);
                   if ('coords' in data) {
                     if (this.refreshStarted != true) {
                       this.refreshStarted = true;
                       this.processPing(data.coords);
                       this.updateStatus.next('done');
                     }
                   } else if (data['message'] == 'Position retrieval timed out.') {
                     this.refreshStarted = false;
                     console.log('GPS timed out.');
                     this.stopLocationWatch();
                     this.startLocationWatch();
                     if (lastData) {
                       this.processPing(lastData);
                     }
                   } else {
                     console.log('Warning: empty GPS ping.');
                     // console.log(JSON.stringify(data, null, 4));
                     this.refreshStarted = false;
                   }
                 }, (error) => {
                   console.log(error);
                   console.log('GPS timed out.');
                   this.refreshStarted = false;
                   if (this.usingCache == false) {
                     this.updateStatus.next('error-gps');
                   }
                 });`
   All the correct parts of entered in Info.plist in the config file, I've tried deleting platforms and the plugin and re-building, it's added correctly to app.module.ts. I've tried with 5.28.0, 5.30.0 and 5.31.1.  I've been searching for 3 days now and nothing has worked! 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-geolocation] breautek commented on issue #221: GPS keeps timing out on iOS

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #221:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/221#issuecomment-775956471


   > It seems to get the position fine twice and then on the third attempt, hit a time out.
   
   This is consistent behaviour for iOS, for when the device cannot get a reliable fix to the geolocation services. When you subscribe to the GPS listener, iOS will provide you with a GPS event immediately, regardless of how accurate or stale that GPS point might be. These GPS points are very likely to be not usable for anything that requires high precision.
   
   > It also worked perfectly fine in Ionic 2 so why it is not working in 5 is a mystery to me.
   
   I can't really comment on anything about Ionic. I wouldn't think this would be in anyway related but perhaps ionic is overriding some behaviour. I would suggest ruling out any framework interference by creating a dummy app that is just simply Cordova and this plugin to see if you see a difference in behaviour.
   
   This doesn't really seem to be a bug though and more of an environmental issue, which is somewhat common for GPS applications, so I'll be closing this ticket. With that being said, I'll add a few more tips, ensure that the device has A-GPS features enabled (such as using Cell towers, wifi, networks, bluetooth, etc). Relying only on GPS satellites can take a significant amount of time to obtain fixes to the satellites. It's not abnormal to take > 15 minutes on cold boots of the GPS chip. I've already summarised a lot of my blog post here, but more in depth information can be found [here](https://breautek.com/articles/geolocation-accuracy.html).  I somewhat recall iOS forcing these features to be always enabled when Location Services are enabled  but not 100% sure so worth a check.
   
   Lastly, a more appropriate place for seeking support would be the Cordova [Slack](http://slack.cordova.io/) community. If you need further assistance, you may have better luck asking there.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-geolocation] junior-senior edited a comment on issue #221: GPS keeps timing out on iOS

Posted by GitBox <gi...@apache.org>.
junior-senior edited a comment on issue #221:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/221#issuecomment-775829947


   Interestingly, the console of XCode is this (replaced the app name and the coords output with 'data' as it has my location in it):
   2021-02-09 11:13:47.375746+0100 AppName[1177:498799] Starting Location Watch
   2021-02-09 11:13:47.376153+0100 AppName[1177:498799] Waiting for GPS
   2021-02-09 11:13:47.376511+0100 AppName[1177:498799] {"coords": data}
   2021-02-09 11:13:47.392079+0100 AppName[1177:498799] THREAD WARNING: ['Geolocation'] took '15.158936' ms. Plugin should use a background thread.
   2021-02-09 11:13:47.413718+0100 AppName[1177:498799] {"coords": data}
   2021-02-09 11:13:57.420804+0100 AppName[1177:498799] {"code":3,"message":"Position retrieval timed out."}
   2021-02-09 11:13:57.421732+0100 AppName[1177:498799] GPS timed out.
   2021-02-09 11:13:57.422282+0100 AppName[1177:498799] Stopping location watch.
   2021-02-09 11:13:57.432880+0100 AppName[1177:498799] Starting Location Watch
   2021-02-09 11:13:57.433449+0100 AppName[1177:498799] Waiting for GPS
   2021-02-09 11:13:57.434797+0100 AppName[1177:498799] {"coords": data}
   2021-02-09 11:13:57.470875+0100 AppName[1177:498799] {"coords": data}
   2021-02-09 11:14:07.477687+0100 AppName[1177:498799] {"code":3,"message":"Position retrieval timed out."}
   2021-02-09 11:14:07.478546+0100 AppName[1177:498799] GPS timed out.
   2021-02-09 11:14:07.479009+0100 AppName[1177:498799] Stopping location watch.
   2021-02-09 11:14:07.483256+0100 AppName[1177:498799] Starting Location Watch
   2021-02-09 11:14:07.483560+0100 AppName[1177:498799] Waiting for GPS
   2021-02-09 11:14:07.484086+0100 AppName[1177:498799] {"coords": data}
   2021-02-09 11:14:07.497861+0100 AppName[1177:498799] THREAD WARNING: ['Geolocation'] took '10.797852' ms. Plugin should use a background thread.
   2021-02-09 11:14:07.519037+0100 AppName[1177:498799] {"coords": data}
   2021-02-09 11:14:17.524690+0100 AppName[1177:498799] {"code":3,"message":"Position retrieval timed out."}
   2021-02-09 11:14:17.525405+0100 AppName[1177:498799] GPS timed out.
   2021-02-09 11:14:17.525792+0100 AppName[1177:498799] Stopping location watch.
   2021-02-09 11:14:17.535857+0100 AppName[1177:498799] Starting Location Watch
   2021-02-09 11:14:17.536698+0100 AppName[1177:498799] Waiting for GPS
   
   It seems to get the position fine twice and then on the third attempt, hit a time out. This is the same output with the CDVLocation.m distanceFilter as None or 5.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-geolocation] breautek commented on issue #221: GPS keeps timing out on iOS

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #221:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/221#issuecomment-775453502


   > I've recently upgraded Ionic from 2 to 5 and for some reason this plugin always results in a GPS time out using watch position on iOS, however, it works without issue on Android.
   
   One major philosophy difference between iOS and Android is iOS will try to be smart about battery life consumption by not providing GPS updates if the phone isn't making any "significant" distance change. I think by default, this is ~5 meters. I have a feeling you might be hitting into this.
   
   Additionally, in my experience, iOS devices is more likely to not provide any GPS updates at all in certain environmental conditions, such as being in a concrete building, whereas Android might (although inaccurate) GPS updates in the same environment. If I wanted to test iOS with real GPS data, I have to physically go outside with my iOS device(s).
   
   You can **try** using my fork at https://github.com/totalpave/cordova-plugin-geolocation.git#totalpave/v1.0.0 (based off of Apache version of `v4.0.1` The most significant change in the fork is to disable the distance filter via https://github.com/totalpave/cordova-plugin-geolocation/commit/a9233d8838c1cc14d955e6654fa11660a4557901


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-geolocation] junior-senior commented on issue #221: GPS keeps timing out on iOS

Posted by GitBox <gi...@apache.org>.
junior-senior commented on issue #221:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/221#issuecomment-775737477


   Thanks for the help, unfortunately that's one of the many things I've tried already, with no luck. One of the users is testing the app in the field travelling over 100m between locations and it's still not working. It also worked perfectly fine in Ionic 2 so why it is not working in 5 is a mystery to me.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-geolocation] breautek closed issue #221: GPS keeps timing out on iOS

Posted by GitBox <gi...@apache.org>.
breautek closed issue #221:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/221


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-plugin-geolocation] junior-senior commented on issue #221: GPS keeps timing out on iOS

Posted by GitBox <gi...@apache.org>.
junior-senior commented on issue #221:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/221#issuecomment-775829947


   Interestingly, the console of XCode is this:
   2021-02-09 11:13:47.375746+0100 AppName[1177:498799] Starting Location Watch
   2021-02-09 11:13:47.376153+0100 AppName[1177:498799] Waiting for GPS
   2021-02-09 11:13:47.376511+0100 AppName[1177:498799] {"coords":{"latitude":52.11079589561756,"longitude":4.288869230080665,"accuracy":10,"altitude":6.370849609375,"heading":null,"speed":0,"altitudeAccuracy":12},"timestamp":1612865616999.7107}
   2021-02-09 11:13:47.392079+0100 AppName[1177:498799] THREAD WARNING: ['Geolocation'] took '15.158936' ms. Plugin should use a background thread.
   2021-02-09 11:13:47.413718+0100 AppName[1177:498799] {"coords":{"latitude":52.11079589561756,"longitude":4.288869230080665,"accuracy":10,"altitude":6.405517578125,"heading":null,"speed":0,"altitudeAccuracy":12},"timestamp":1612865626999.7063}
   2021-02-09 11:13:57.420804+0100 AppName[1177:498799] {"code":3,"message":"Position retrieval timed out."}
   2021-02-09 11:13:57.421732+0100 AppName[1177:498799] GPS timed out.
   2021-02-09 11:13:57.422282+0100 AppName[1177:498799] Stopping location watch.
   2021-02-09 11:13:57.432880+0100 AppName[1177:498799] Starting Location Watch
   2021-02-09 11:13:57.433449+0100 AppName[1177:498799] Waiting for GPS
   2021-02-09 11:13:57.434797+0100 AppName[1177:498799] {"coords":{"latitude":52.11079589561756,"longitude":4.288869230080665,"accuracy":10,"altitude":6.405517578125,"heading":null,"speed":0,"altitudeAccuracy":12},"timestamp":1612865626999.7063}
   2021-02-09 11:13:57.470875+0100 AppName[1177:498799] {"coords":{"latitude":52.11079589561756,"longitude":4.288869230080665,"accuracy":10,"altitude":6.49945068359375,"heading":null,"speed":0,"altitudeAccuracy":8},"timestamp":1612865636999.7063}
   2021-02-09 11:14:07.477687+0100 AppName[1177:498799] {"code":3,"message":"Position retrieval timed out."}
   2021-02-09 11:14:07.478546+0100 AppName[1177:498799] GPS timed out.
   2021-02-09 11:14:07.479009+0100 AppName[1177:498799] Stopping location watch.
   2021-02-09 11:14:07.483256+0100 AppName[1177:498799] Starting Location Watch
   2021-02-09 11:14:07.483560+0100 AppName[1177:498799] Waiting for GPS
   2021-02-09 11:14:07.484086+0100 AppName[1177:498799] {"coords":{"latitude":52.11079589561756,"longitude":4.288869230080665,"accuracy":10,"altitude":6.49945068359375,"heading":null,"speed":0,"altitudeAccuracy":8},"timestamp":1612865636999.7063}
   2021-02-09 11:14:07.497861+0100 AppName[1177:498799] THREAD WARNING: ['Geolocation'] took '10.797852' ms. Plugin should use a background thread.
   2021-02-09 11:14:07.519037+0100 AppName[1177:498799] {"coords":{"latitude":52.11079589561756,"longitude":4.288869230080665,"accuracy":10,"altitude":6.43035888671875,"heading":null,"speed":0,"altitudeAccuracy":12},"timestamp":1612865646999.6958}
   2021-02-09 11:14:17.524690+0100 AppName[1177:498799] {"code":3,"message":"Position retrieval timed out."}
   2021-02-09 11:14:17.525405+0100 AppName[1177:498799] GPS timed out.
   2021-02-09 11:14:17.525792+0100 AppName[1177:498799] Stopping location watch.
   2021-02-09 11:14:17.535857+0100 AppName[1177:498799] Starting Location Watch
   2021-02-09 11:14:17.536698+0100 AppName[1177:498799] Waiting for GPS
   
   It seems to get the position fine twice and then on the third attempt, hit a time out. This is the same output with the CDVLocation.m distanceFilter as None or 5.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org