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

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.

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

@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?

@LAFONT I found my answer in the documentation: Geolocation - Apache Cordova

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.

1 Like

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

Sorry for that