Why use cordova-plugin-geolocation instead of of the JS's navigator.geolocation API


#1

I need to get the users current location and the Javascript API navigator.geolocation seems sufficient for my needs but am wondering why others use cordova-plugin-geolocation. Does the plugin offer something more or more reliable etc?

Thanks.


#2

Hi,

Typescript is just a superset of javascript. Typescript transpile to javascript. The performances are identical.

updated: error on my side, wrong post, wrong answer :slight_smile: too many window opens!

Sorry for that


#3

@LAFONT I don’t think you understood my question. Sorry if I haven’t been clearer.

My question is about https://github.com/apache/cordova-plugin-geolocation. What is the benefit of using this plugin? Under the hood it seems to be using navigator.geolocation API so why not use it directly in the code?


#4

@LAFONT I found my answer in the documentation: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-geolocation/

The plugin is doing the same thing as the desktop browser but provides backward compatibility for devices that do not support navigator. geolocation:

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


#5

error on my side, wrong post, wrong answer :slight_smile: too many window opens!

Sorry for that