Blog RSS Feed

Geolocation Plugin 5.0.0 Released!
By: Norman Breau
21 Sep 2023

We are happy to announce that we have just released an update for cordova-plugin-geolocation!

To upgrade:

cordova plugin remove cordova-plugin-geolocation
cordova plugin add cordova-plugin-geolocation@5.0.0

Release Highlights

Breaking Changes

  • Modern JavaScript

The JavaScript of the plugin has been upgraded to use ES6 features, such as let and const.

NOTE: This release has failed to upgrade required engines. Despite the declared requirement on cordova-android >= 6.3.0 and no declared requirement on iOS, the new minimum requirements will be:

  • cordova-ios 6 or later
  • cordova-android 10 or later

Earlier versions of these platforms may not work as expected. As always, it will be recommended to use the latest version available. The engines may be corrected in a patch release at a later date.

  • Cordova Windows Support Drop

Support for the deprecated cordova-windows platform has been dropped and entirely removed in this release.

Notable Fixes

  • Sanity check on Geolocation serialization on iOS

    A rare occurrence of Infinity values would cause a crash during JSON serialization on iOS. This is now caught and will now produce a Position Unavailable error gracefully.

  • Improved Android Permission Handling

    Android has received fixes for when handling coarse vs fine location permissions for improved compatibility on Android 12+ devices. Android will now handle the following situations:

    1. Permission request that consists of only COARSE location.
    2. Permission request that consists of both COARSE and FINE (high accuracy) location.
    3. Permission upgrade for when COARSE is granted, but FINE is required.

For more details on these changes, see the PR.

  • Improved W3C Compliance

Fixes has been made to the heading and speed to better conform to the W3C Geolocation API specification. If either of these values are not determined to be expected valid range, they will now return null to provide better consistency between Cordova and other web environments.

Please report any issues you find by following the this How to File a Bug guide!

Changes Log

Breaking Changes:

  • GH-260 chore(eslint): config upgrade to 5.0.0 (#260)
  • GH-267 chore(windows)!: Remove Windows platform (#267)

Fixes:

  • GH-270 fix: heading speed w3c spec (#270)
  • GH-250 (android) fix: respect requested location accuracy when checking/requesting permissions on Android 12+ Handle bug on API < 32 when requesting COARSE permission results in TIMEOUT error.
  • GH-231 (ios) fix: Check NSDictionary constructed from native CLLocation data is valid for conversion to JSON before attempting conversion. Prevents crashes due to values invalid for JSON conversion such as INFINITY.

Other Changes:

  • GH-247 ci(android): update java requirement for cordova-android@11 (#247)
  • GH-241 ci(ios): update workflow w/ iOS 15 (#241)
  • GH-239 ci: add action-badge (#239)
  • GH-238 ci: remove travis & appveyor (#238)
  • GH-236 chore: npmrc (#236)
  • GH-234 ci: add gh-actions workflows (#234)
  • GH-217 ci: add node-14.x to workflow (#217)
  • GH-251 ci: sync workflow with paramedic (#251)
  • GH-249 dep(npm): bump package-lock v2 w/ rebuild (#249)
  • GH-268 ci(gh-action): Sync with paramedic configs (#268)
  • GH-261 ci: Sync with paramedic. Removed API 22 & 31, added API 24 & API 33 (#261)
  • GH-265 chore: package-lock (#265)
  • GH-269 test(windows): Remove window platform references from tests (#269)