Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation seems misleading about whether or not the plugin is necessary #186

Closed
3 tasks done
ekrapfl opened this issue Jan 3, 2020 · 1 comment · Fixed by #194
Closed
3 tasks done

Documentation seems misleading about whether or not the plugin is necessary #186

ekrapfl opened this issue Jan 3, 2020 · 1 comment · Fixed by #194

Comments

@ekrapfl
Copy link

ekrapfl commented Jan 3, 2020

Bug Report

Looking at this in the documentation:

This API is based on the W3C Geolocation API Specification, and only executes on devices that don't already provide an implementation.

I assumed that because my app runs on latest Safari in iOS (which provides an implementation of the geolocation API), that I would no longer require this plugin. I removed the plugin, but iOS no longer allows access to geolocation.

Problem

If you remove the plugin and deploy on iOS (using a non-https url), you will get the following error when trying to use navigator.geolocation:

[blocked] Access to geolocation was blocked over insecure connection to ionic://localhost

What is expected to happen?

According to the documentation, I would have expected to be able to use the navigator.geolocation API (without this plugin) for any Cordova application. For iOS, however the plugin is still required because of the limitation Apple has placed on the geolocation API on insecure URLs. Furthermore, the documentation seems to indicate that the plugin does nothing at all if the API is available in the browser. Clearly, that is not true. It appears that it clobbers the API, whether it exists or not (and I am glad it does :D).

Environment, Platform, Device

An Ionic app
iOS only

Version information

I am using @ionic/angular 4.11.1, and cordova-plugin-ionic-webview 4.0.0

Ionic:

   Ionic CLI                     : 5.4.4
   Ionic Framework               : @ionic/angular 4.11.1
   @angular-devkit/build-angular : 0.803.13
   @angular-devkit/schematics    : 8.3.13
   @angular/cli                  : 8.3.13
   @ionic/angular-toolkit        : 2.1.1

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.1.0, ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.0, (and 17 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.9 (update available: 0.3.0)

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.2
   NodeJS     : v10.16.3 (/usr/local/Cellar/node@10/10.16.3/bin/node)
   npm        : 6.9.0
   OS         : macOS Catalina
   Xcode      : Xcode 11.3 Build version 11C29

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@breautek
Copy link
Contributor

breautek commented Jan 3, 2020

It could be more clear because i believe the plugin is still required to mark capabilities and/or provide the native permission modal, regardless if the browser provides a geolocation api or not.

For example the plugin doesn't actually implement the geolocation api for android, but it does handle the permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants