geolocator_apple

2.4.3

Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator.

Download archive

Readme

geolocator_apple

pub package Build status style: effective dart

The official iOS and macOS implementation of the geolocator plugin by Baseflow.

Usage

Since version 7.5.0 of the geolocator plugin this is the endorsed iOS and macOS implementation. This means it will automatically be added to your dependencies when you depend on geolocator: ^7.5.0 in your applications pubspec.yaml.

More detailed instructions on using the API can be found in the README.md of the geolocator package.

Maritime positioning

For location streams used on boats, including while anchored, select ActivityType.maritime:

final settings = AppleSettings(activityType: ActivityType.maritime);
final positions = GeolocatorApple().getPositionStream(locationSettings: settings);

This uses Core Location's maritime activity type when built with the iOS 27 or macOS 27 SDK (Xcode 27 or later) and running on that OS version or later. On older SDKs or operating systems, it falls back to ActivityType.otherNavigation. Existing activity types and the default activity type are unchanged.

Issues

Please file any issues, bugs or feature requests as an issue on our GitHub page. Commercial support is available, you can contact us at hello@baseflow.com.

Want to contribute

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author

This Geolocator plugin for Flutter is developed by Baseflow.

Changelog

2.4.3

  • Fixes getCurrentPosition never completing when it is called again before an earlier call has completed. The new request replaced the handlers of the pending one, which was left waiting forever. Requests made while another one is pending now share its location updates, and all of them complete with the same position or error, using the most accurate of the requested accuracies. Each new request restarts the kCLErrorLocationUnknown grace period for every pending request.

2.4.2

  • Reads the location permission status off the main thread in checkPermission, requestPermission, getCurrentPosition and getLastKnownPosition. The status read waits for a synchronous reply from locationd, which froze the app for seconds when locationd was slow to answer.

2.4.1

  • Fixes getCurrentPosition never completing when Core Location cannot determine a position, for example on a Mac with Wi-Fi turned off. Core Location reports kCLErrorLocationUnknown and keeps trying; a single position request now fails with a PositionUpdateException when no position arrives within 6 minutes of that error — longer than the 5-minute interval at which macOS rescans Wi-Fi networks for a position, so requests that would still succeed are not cut short. Position streams keep waiting, as before.

2.4.0

  • Adds ActivityType.maritime for vessels on water, including while anchored, on iOS 27 and macOS 27. Falls back to ActivityType.otherNavigation when built with an older SDK or running on an older OS.

2.3.15

  • Adds support for the BYPASS_PERMISSION_LOCATION_ALWAYS flag when using Swift Package Manager (SPM). Set the BYPASS_PERMISSION_LOCATION_ALWAYS=1 environment variable when building to bypass the request for permission to update location in the background, matching the existing CocoaPods behavior.

2.3.14

  • Updates flutter_lints to version 6.0.0.

2.3.13

  • Adds Swift Package Manager compatibility.

2.3.12

  • Removed deprecated -[UIApplication openURL:] dead code.

2.3.11

  • Adds privacy manifest for macOS to the podspec.

2.3.10

  • Updated dart sdk to sdk: ^3.5.0
  • Fixed example project warnings

2.3.9

  • Adds privacy manifest for macOS.

2.3.8+1

  • HOT FIX: Adds back implementation of the stopListening method in the GeolocationHandler.m file.

2.3.8

  • Uses different CLLocationManager instances, for one time request location and persistent request location.
  • Fixes a bug where iOS location settings, e.g. accuracy and distanceFilter are overridden by different calls.
  • Updates minimum deployment target to iOS 11 as lower is not supported anymore by Xcode.

2.3.7

  • Adds privacy manifest.

2.3.6

  • Adds option to bypass the request for permission to update location in the background (which can attract scrutiny from Apple upon app submission). To bypass, set the preprocessor macro BYPASS_PERMISSION_LOCATION_ALWAYS to 1 in XCode.

2.3.5

  • Previously the plugin filtered out negative values for heading and/or heading accuracy. Now the plugin is returning the heading and/or the heading accuracy even if the they have a negative value (invalid), so that the developer can use it and decide what to do with it.

2.3.4

  • Allows the ARM64 architecture as a valid IPhone simulator architecture.

2.3.3

  • Ensures the [CLLocationManager locationServicesEnabled] message is called on a background thread when listening for service updates.

2.3.2

  • Fixes build error and warnings regarding unused variables and unavailable APIs on macOS.

2.3.1

  • Fixes a bug where invalid speed and speed accuracy readings where returned instead of ignored.

2.3.0

  • Includes altitudeAccuracy and headingAccuracy in Position.

2.2.7

  • Fixes the propagation of the activity type setting.

2.2.6

  • Ensures the isLocationServicesEnabled method is executed in a background thread.

2.2.5

  • Fixes a bug where iOS location manager background geolocation settings are overridden by calls to the getCurrentPosition method.

2.2.4

  • Fix plugin registration in dart_plugin_registrant.dart

2.2.3

  • Implement allowBackgroundLocationUpdates iOS setting

2.2.2

  • Fix requesting location while listening to location stream stops the stream

2.2.1

  • Migrates to Dart SDK 2.15.0 and Flutter 2.8.0.

2.2.0

  • Raises minimum Dart version to 2.17 and Flutter version to 3.0.0.
  • Updates isMocked flag on iOS 15 and higher.
  • Updates the example application to request permissions when start listening to the position stream.

2.1.4

  • Fix background location indicator not showing on first time using the service.

2.1.3

  • Fixes repository URL of the package.

2.1.2

  • Switches to a package-internal implementation of the platform interface.

2.1.1+1

  • Resolves issue with symbolic links in 2.1.1 version.

2.1.1

  • Added additional option to Apple settings to allow the user to configure the background location indicator of CLocationManager.

2.1.0

  • Ensures that the getCurrentPosition takes the supplied accuracy into account.
  • Improves the speed of acquiring the current position.
  • Adds a native test bed.

2.0.1

  • Updated to the latest version of the geolocator_platform_interface': 4.0.0`.

2.0.0+2

  • Removes the Android specific timeInterval parameter from AppleSettings.

2.0.0+1

  • Adds missing timeLimit to the AppleSettings class.

2.0.0

  • iOS: Keep PositionStream alive when the Location Services has been turned off and on again in the settings.
  • Removed implicit request for permissions when getting a position.
  • Added the [ActivityType] enum needed for the pauseLocationUpdatesAutomatically property.
  • Added the pauseLocationUpdatesAutomatically and activityType property to the iOS options class.

1.2.2

  • Fixed iOS cancelation of positionStream.

1.2.1

  • Use requestAlwaysAuthorization instead of requestWhenInUseAuthorization on macOS as both result in the same behaviour but the former has better support on Catelina.

1.2.0

  • Make sure the getCurrentPosition method returns the current position and not a cached location which might be wrong (see issue #629).

1.1.0

  • Added support for macOS Desktop.

1.0.0

  • Initial open source release.

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add geolocator_apple
pubspec.yaml
name: geolocator_apple
description: Geolocation Apple plugin for Flutter. This plugin provides the Apple implementation for the geolocator.
repository: https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_apple
issue_tracker: https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen
version: 2.4.3

environment:
  sdk: ^3.5.0
  flutter: ">=2.8.0"

flutter:
  plugin:
    implements: geolocator
    platforms:
      ios:
        pluginClass: GeolocatorPlugin
        dartPluginClass: GeolocatorApple
        sharedDarwinSource: true
      macos:
        pluginClass: GeolocatorPlugin
        dartPluginClass: GeolocatorApple
        sharedDarwinSource: true

dependencies:
  flutter:
    sdk: flutter
  geolocator_platform_interface: ^4.1.0

dev_dependencies:
  async: ^2.8.2
  flutter_test:
    sdk: flutter
  flutter_lints: ^6.0.0
  mockito: ^5.2.0
  plugin_platform_interface: ^2.1.2

Version history

VersionPublishedArchiveSHA-256
1.0.0On demandDownload651b2a2c…fccb7b
1.1.0On demandDownloadef27bf52…527c4d
1.2.0On demandDownload616f1496…45d206
1.2.1On demandDownload346f97c9…d1c62b
1.2.2On demandDownload1e8e398c…29991e
2.0.0On demandDownloadd21b9ab2…fa6b44
2.0.0+1On demandDownloada7d21d7d…2bc857
2.0.0+2On demandDownloade8f7bb7e…df4d72
2.0.1On demandDownloade89df269…5929bc
2.1.0On demandDownload57dcce50…2842c6
2.1.1On demandDownload87a210ee…94f3eb
2.1.1+1On demandDownload518b0376…b876b0
2.1.2On demandDownloade275c450…211a5e
2.1.3On demandDownloadfe5e7991…9f1575
2.1.4On demandDownloadcb700c8b…6466ef
2.2.0On demandDownloadd8b730eb…828d61
2.2.1On demandDownload1b17544d…f5bfe8
2.2.2On demandDownloada0610669…33e5d3
2.2.3On demandDownload567cf6d9…d3b166
2.2.5On demandDownload22b60ca3…266f2e
2.2.6On demandDownloadd29a4bdd…c0d3b1
2.2.7On demandDownload36527c55…c1cfb4
2.3.0On demandDownloadf348c55b…1b4f1d
2.3.1On demandDownload2c0187c8…e72b65
2.3.2On demandDownloadab90ae81…93f73d
2.3.3On demandDownload1d938e24…f479b1
2.3.4On demandDownload16cdb6b8…14f198
2.3.5On demandDownload79babf44…b248bf
2.3.6On demandDownload2f2d4ee1…e49ef4
2.3.7On demandDownloadbc2aca02…0732fd
2.3.8On demandDownloadf47bca50…74ebd3
2.3.8+1On demandDownload6154ea26…064807
2.3.9On demandDownloadc4ecead1…2b3ba3
2.3.11On demandDownload7c6c67ef…4b8a32
2.3.12On demandDownload419e50f7…b717e6
2.3.13On demandDownloaddbdd8789…21bf22
2.3.14On demandDownload853803d6…0c0b73
2.3.15On demandDownload3b3189be…4be1fa
2.4.0On demandDownload3d26d5e7…b65c01
2.4.1On demandDownloadb23ac316…1e2fc2
2.4.2On demandDownloada596abae…aa4ffe
2.4.3Cached · Upstream SHA-256 matchedDownloada1e177f3…11ab66

Dependencies

flutter { "sdk": "flutter" }

geolocator_platform_interface "^4.1.0"