flutter_background_geolocation 4.18.0
flutter_background_geolocation: ^4.18.0 copied to clipboard
The most sophisticated background location tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
CHANGELOG #
4.18.0 — 2025-09-08 #
- [Android] Remove Huawei HMS support for failure to provide their SDKs with Android 16KB Page Size compatibility.
4.17.1 — 2025-08-25 #
- Fix example/pubspec.yaml
enable-swift-package-manager: true
4.17.0 — 2025-07-28 #
- [iOS] Implement Swift Package Manager support
- [example] Re-factor /example app's location marker images.
4.16.12 — 2025-07-07 #
- [Android] Rebuild
tslocationmanagerwith AGP >= 8.5.1 - [example] Update example's
flutter_mapto latest8.1.1 - [Android] Implement behaviour for
locationAuthorizationRequest: "Any"to not continue showingbackgroundPermissionRationaleafter user clicks[CANCEL]button.
4.16.11 — 2025-06-16 #
- [Android] Fix issue with polygon geofencing where
identifierconsists of long strings, such asaaaa-bbbb-cccccccc-dddd-eeeee eeeeeee. - [Android] Fix edge-case where polygons can fail to fire after the containing geofence is exited. This could happen if the containing geofence was exited without trigger an onMotionChange event.
- [iOS] Fix edge-case where polygon could fail to fire EXIT event after launching from terminated state when the containing geofence is exit causes background app restart.
4.16.10 — 2025-05-16 #
- [Android] Support 16KB pages sizes.
- [iOS] Fix
ProviderChangeEvent.enablednot showing the result of global Privacy -> Location Services -> Enabled switch - [Android] Fix
java.util.ConcurrentModificationException at com.transistorsoft.locationmanager.location.SingleLocationRequest.getBestLocation.
4.16.9 — 2025-02-13 #
- [Android] Re-compile library with jdk 17
4.16.8 — 2025-02-13 #
- [Android] Re-compile library with jdk 17 instead of 22
4.16.7 — 2025-02-13 #
- [Android] Fix
ConcurrentModificationExceptioninStopTimeoutEvaluator.
4.16.6 — 2024-12-19 #
- [Android] Address phenonenon of "UI Freezing".
4.16.5 — 2024-12-03 #
- [Android] Remove Android Setup Step for
proguard-rules.proin yourandroid/app/build.gradle. The SDK is now able to automatically apply its requiredproguard-rules.pro.
4.16.4 — 2024-11-12 #
- [Android] Remove enforcement of minimum Geofence radius
150 - [Android] Fix issue with
TSLocationManagerActivity(responsible for showing location permission / authorization dialogs). Minimizing the app with an active permission dialog would cause the app'sMainActivityto terminate on some devices.
4.16.3 — 2024-11-08 #
- [Android] Fix reported "screen flickering" issue on some devices when SDK requests permissions.
- [Android] Address Android synchronization issue with
TSLocation.toMap. - [iOS] Address crash in
TSConfigdue to "uncaught exception NSInvalidArgumentException" - [Android] Change
foregroundServiceTypeonLocationRequestServicefromshortService->location. - [iOS] Address inconsistent location-tracking performance on iOS.
4.16.2 — 2024-10-23 #
- [iOS] Fix bug with
triggerActivitespreventing motion-triggering in iOS simulator with simulated location.
4.16.1 — 2024-10-21 #
- [Android] Implement
Service.onTimeoutto handleforegroundServiceType="shortService"timeouts. - [iOS] Add new
Config.activityTypeACTIVITY_TYPE_AIRBORNE. - [iOS] Implement
Config.triggerActivitiesfor iOS. - [Android] Guard against
NullPointerExceptionreceiving a null location inPolygonGeofenceServiceevent. - [Android] Remove unused
imports related to Flutter V1 Embedding. - [Android] Address possible leak of
Activityreference when terminating the app. Ensure internal reference toActivityis nullified when app is terminated. - [Android] Add improvements to Android geofencing-only mode with
goefenceModeHighAccuracy: truewhere motion-activity updates disabled. - [Android] Add error-checking in polygon-geofencing to handle a possible
NullPointerException. - [iOS] Fix broken linking to Settings screen in
locationAuthorizationAlerton iOS 18.
4.16.0 — 2024-09-04 #
- [iOS] Fix bug in iOS Polygon Geofencing when running in geofences-only mode (
.startGeofences). iOS would mistakenly turn off location updates exactly 3 samples into the containing circular geofence of a polygon. - Implement
notifyOnDwellfor polygon-geofences.
4.15.5 — 2024-06-12 #
- [Android] Remove permission
FOREGROUND_SERVICE_HEALTH. It turns out that this permission is no longer required when theActivityRecognitionServivceis defined with aforegroundServiceType="shortservice", which allows a background-launched foreground-service to stay active for up to 3 minutes, which is sufficient for theActivityRecognitionService, which typically stays activated only for a few milliseconds.
4.15.4 — 2024-06-05 #
- [Android] Fix issues #1298 "Multiple geofence events triggered for a single geofence registration when registered individually".
4.15.3 — 2024-05-14 #
- [Android] Fix bug in .getCurrentPosition not returning or throwing an error in a condition where Network OFF and GPS ON.
- Fix bug in .changePace exception-handling, throwing a
FormatExceptioninstead ofPlatformException.
4.15.2 — 2024-04-22 #
- [iOS] Code-sign
TSLocationManager.xcframeworkwith new Apple Organization (9224-2932 Quebec Inc) certificate.
4.15.1 — 2024-03-27 #
- [iOS] Add PrivacyInfo -> TSLocationManager.xcframework
- [iOS] codesign TSLocationManager.xcframework
- [iOS] Update
CocoaLumberjackversion ->3.8.5(version which includes its ownPrivacyInfo) .
4.15.0 — 2024-03-19 #
- [iOS] Implement new iOS Privacy Manifest
- Add property
AuthorizationEvent.status, provding the HTTP status code from therefreshUrl.
4.14.3 — 2024-03-18 #
- [iOS] Fix bug in iOS scheduler, triggering ON incorrectly. For example, given a
schedule: ['1 00:00-23:59'], the plugin was trigging on forDAY 2`.
4.14.2 — 2024-03-14 #
- [iOS] Fix bug in polygon-geofencing: monitoredIdentifiers not being cleared when
.removeGeofences()is called, can result in null-pointer exception.
4.14.1 — 2024-03-12 #
- [Android] Change
foregroundServiceTypeof the SDK'sGeofencingServicedefinition in itsAndroidManifestfromshortService->location.
4.14.0 — 2024-02-27 #
- [iOS] Modify behaviour of stop-detection system to NOT turn off location-services but merely adjust desiredAccuracy as high as possible. There were problems reported using
locationAuthorizationRequest: 'WhenInUse'with recent versions of iOS where the stop-detection system could put the app to sleep during tracking if the motion API reported the device became momentarily stationary.
4.13.7 — 2024-02-13 #
- Fix minor static analysis issues reported in
dartcode referencingpart-ofdirective.
4.13.6 — 2024-02-08 #
- [Android] Add multi FlutterEngine support to Android
4.13.5 — 2023-11-16 #
- [Android] Fix problem with polygon-geofencing license-validation not working in DEBUG builds when configured with product flavors.
4.13.4 — 2023-11-06 #
- [Android] HMS geolocation event does not provide a timestamp for the triggering location!! Use System current time.
- [Android] Remove deprecated flutter V1 plugin architecture code (
registerWith). - [Android] Guard against Geofence SQLite query returning null in
GeofencingService. - [Android] Fix
ConcurrentModificationExceptioninSingleLocationRequest.getBestLocation
4.13.3 — 2023-10-12 #
- [Android] Fix
IllegalStateExceptioncalling addGeofences when number of geofences exceeds platform maximum (100).
4.13.2 — 2023-10-05 #
- [Android] Fix error Unhandled Exception: type 'Null' is not a subtype of type 'List<Object?>' in
BackgroundGeolocation.geofences/getGeofence(uuid). - [iOS] Rename iOS Obj-c classes, prefixing with
TS.
4.13.1 — 2023-10-02 #
- [iOS] Fix "Duplicate symbol error DummyPods_TSLocationManager".
4.13.0 — 2023-09-28 #
- Polygon Geofencing: The Background Geolocation SDK now supports Polygon Geofences (Geofences of any shape). For more information, see API docs
Geofence.vertices. ℹ️ Polygon Geofencing is sold as a separate add-on (fully functional in DEBUG builds).

- Remove
backup_rules.xmlfromAndroidManifest.xml— it's causing conflicts with other plugins. - [Android] Add proguard-rule for compilation of the android library to prevent from obfuscating the
BuildConfigclass toa.a.class, conflicting with other libraries.
4.12.3 — 2023-09-05 #
- [Android] Performance enhancements and error-checking.
4.12.2 — 2023-08-24 #
- [Android] Fix memory-leak in
.startBackgroundTask: If aTasktimed-out and is "FORCE KILLED", it was never removed from aList<Task>. - [Android] Fix
Exception NullPointerException:at com.transistorsoft.locationmanager.util.BackgroundTaskWorker.onStopped
4.12.1 — 2023-08-23 #
- [iOS] Fix build failure "Use of '@import' when C++ modules are disabled"
- [Android] Modify Foreground-service management to use
stopSelfResult(startId)instead ofstopSelf(). This could improve reports of Android ANRContext.startForeground. - [Android] Add sanity-check for invalid
Geofencearguments (eg: invalid latitude/longitude). - [Android] Add safety-checks in ForegroundService stop-handling. There was a report of a reproducible crash while aggressively calling
.getCurrentPositionin aTimer(eg: every second). - [Android] Demote
HeartbeatServicefrom a Foreground Service toAlarmManagerONESHOT. ⚠️ In youronHeartbeatevent, if you intend to perform any kind of asynchronous function, you should wrap it insideBackgroundGeolocation.startBackgroundTaskin order to prevents the OS from suspending your app before your task is complete:
BacckgroundGeolocation.onHeartbeat((event) async {
print("[onHeartbeat] $event");
// First register a background-task.
var taskId = await BackgroundGeolocation.startBackgroundTask();
try {
// Now you're free to perform long-running tasks, such as getCurrentPosition()
var location = await BackgroundGeolocation.getCurrentPosition(
samples: 3,
timeout: 30,
extras: {
"event": "heartbeat"
}
);
print("[onHeartbeat] location: $location");
} catch(error) {
print("[getCurrentPosition] ERROR: $error");
}
// Be sure to singal completion of your background-task:
BackgroundGeolocation.stopBackgroundTask(taskId);
});
- [Android] Fix NPE iterating a
ListinAbstractService. - [Android] If a
SingleLocationRequesterror occurs and at least one sample exits, prefer to resolve the request successfully rather than firing the error (eg:getCurrentPosition,motionchange,providerchangerequests).
4.12.0 — 2023-08-16 #
- [Android] ⚠️ If you have the following elements defined in your
AndroidManifest.xml, DELETE them:
- <service android:name="com.transistorsoft.locationmanager.service.TrackingService" android:foregroundServiceType="location" />
- <service android:name="com.transistorsoft.locationmanager.service.LocationRequestService" android:foregroundServiceType="location" />
- [Android] Re-factor getCurrentPosition to prefer more recent location vs more accuracy (within limits)
- [Android] Android 14 (API 34) support: Android 14 is more strict with scheduling
AlarmManager"exact alarms" (which the plugin does take advantage of). If you wish the plugin to useAlarmManager"exact alarms" in your app, you must now explicitly define that permission in your ownAndroidManifest:
<manifest>
<uses-permission android:minSdkVersion="34" android:name="android.permission.USE_EXACT_ALARM" />
</manifest>
- [Android] Android 14 (API 34) support: Re-factor BackgroundTaskService to use
WorkManagerinstead of a foreground-service. - [Android] Android 14 (API 34) support: Due to new runtime permission requirements on
AlarmManagerexact alarms (android.permission.SCHEDULE_EXACT_ALARM), the plugin can no longer rely upon launching a foreground-service using an exact alarm. Instead, the plugin will create a geofence around the current position (configured withinitialTriggerEntry) to hopefully immediately launch a foreground-service to handle the fake geofence event, since Android allows foreground-service launches due to Geofencing events. - [Android] Android 14 (API 34) support: All foreground-services now require an
android:foregroundServiceTypein the plugin'sAndroidManifest(handled automatically by the plugin). - [Android] Android 14 (API 34) support: Fix error "One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified" in
DeviceSettings.startMonitoringPowerSaveChanges.
4.11.1 — 2023-06-09 #
- Fix nullsafety issue in
TransistorAuthorizationToken.destroy. - [Android] Log
ApiException.getStatusCode()if nativeaddGeofencemethod fails. - Update /example app for full nullsafety.
4.11.0 — 2023-05-04 #
- [Android] Gradle v8 now requires
namespaceattribute in gradle files. - [iOS] iOS 16.4 made a major change to location-services, exposed only when
Config.showsBackgroundLocationIndicatorisfalse(the default). As a result of this change,Config.showsBackgroundLocationIndicatorwill now default totrue.
4.10.3 — 2023-04-19 #
- [Android] Upgrade
logback-androiddependency to3.0.0(org.slf4j-apito `2.0.7).
4.10.2 — 2023-04-12 #
-
[Android] Fix String concatenation issue on Turkish devices where method-name composed for use with reflection is incorrectly capitalized (ie:
isMoving ->setIsMovingis incorrectly capitalized with Turkish capital assetİsMoving. Simply enforceLocale.ENGLISHwhen performingString.toUpperCase(Locale.ENGLISH)`. -
[iOS] Fix bug in TSScheduler. When schedule was cleared via .setConfig, only the State.schedulerEnabled property was set to false, but the TSScheduler singleton contained an internal 'enabled' property which was not reset to false. Solution was to simply call stop() method upon TSScheduler singleton.
4.10.1 — 2023-03-30 #
- [Android] Bump default
hmsLocationVersion = 6.9.0.300. There are reports of Google rejecting apps due to older huawei HMS dependenc ies. - [Android] Fix
ClassCastExceptionrelated to Motion API error
4.10.0 — 2023-03-29 #
- [Android] Introduce Huawei HMS Support. Requires a separate license key purchased here.
- [iOS] Fix for iOS 16.4. iOS 16.4 introduces changes to CoreLocation behaviour when using Config.showsBackgroundLocationIndi cator: false.
- [Android] Added extra logic in a location error-handler to mitigate against a possible edge-case where a location-error fetching the onMotionChange position could possibly result in an infinite loop, causing a stackoverflow exception:
at com.transistorsoft.locationmanager.service.TrackingService.changePace(TrackingService.java:264)
at com.transistorsoft.locationmanager.service.TrackingService$c.onError(TrackingService.java:69)
at com.transistorsoft.locationmanager.location.SingleLocationRequest.onError(SingleLocationRequest.java:18)
at com.transistorsoft.locationmanager.location.SingleLocationRequest.start(SingleLocationRequest.java:71)
at com.transistorsoft.locationmanager.location.TSLocationManager.getCurrentPosition(TSLocationManager.java:3)
at com.transistorsoft.locationmanager.service.TrackingService.changePace(TrackingService.java:321)
at com.transistorsoft.locationmanager.service.TrackingService$c.onError(TrackingService.java:69)
at com.transistorsoft.locationmanager.location.SingleLocationRequest.onError(SingleLocationRequest.java:18)
at com.transistorsoft.locationmanager.location.SingleLocationRequest.start(SingleLocationRequest.java:71)
at com.transistorsoft.locationmanager.location.TSLocationManager.getCurrentPosition(TSLocationManager.java:3)
at com.transistorsoft.locationmanager.service.TrackingService.changePace(TrackingService.java:321)
at com.transistorsoft.locationmanager.service.TrackingService$c.onError(TrackingService.java:69)
at com.transistorsoft.locationmanager.location.SingleLocationRequest.onError(SingleLocationRequest.java:18)
at com.transistorsoft.locationmanager.location.SingleLocationRequest.start(SingleLocationRequest.java:71)
.
.
.
4.9.0 — 2023-02-01 #
- [Fixed][Android] Implement support for
play-services-location v21(ext.playServicesLocationVersionin yourandroid/build.gradle). The plugin can now work with either<= v20or>= v21.
4.8.7 — 2023-01-25 #
- [Fixed] Resolve minor dart static analysis warnings (mostly to do with curly braces).
4.8.6 — 2023-01-19 #
- [Changed] Android Update
logback-androidversion.
4.8.5 — 2022-12-12 #
- [Fixed] Android: Catch
Fatal Exception: java.lang.IllegalArgumentException: NetworkCallback was already unregistered - [Fixed] Android It has been discovered that the Android logger
logback-androidhas not been automatically clearing all expired records (Config.logMaxDays) from the log database. Thelogback-androiddatabase consists of three tables and only one was being cleared (see https://github.com/tony19/logback-android/pull/214), resulting in a constantly growing database (wherelogLevel > LOG_LEVEL_OFF). This version of the plugin will alter thelogback-androiddatabase tables withON DELETE CASCADEto ensure all log-data is properly removed. - [Added] Added two new HTTP RPC commands
stopScheduleandstartSchedule(See API docs HTTP Guide for more information).
4.8.4 — 2022-11-03 #
- [Fixed] Fixed bug in
onLocationerror-handler. If multiple onLocation event-handlers are registered, only the first registered error callback would be executed (once for each listener) when a LocationError occurs.
4.8.3 — 2022-10-27 #
- [Android] add
@pragma('vm:entry-point') to lib's_headlessCallbackDispatcher`, required for release builds on Flutter >= 3.3.0.
4.8.2 — 2022-10-26 #
- [Android] Fix logic error with
getCurrentPositionnot respectingtimeout. - [Android]
play-services:locationhas introduced a breaking change inv21, breaking the plugin.googlePlayServicesLocationVersionwill be capped with a maximum ofv20. The next major release (4.10.0) will set a minimum required version ofv21.
4.8.1 — 2022-10-14 #
- [iOS] Rebuild
TSLocationManager.xcframeworkwith XCode 13. - [Android] Remove obsolete steps from Android Setup instructions.
4.8.0 — 2022-09-29 #
- [iOS] Build
TSLocationManager.xcframeworkwith XCode 14. - [Android] Add new Config Notification.channelId for custom customizing the NotificationChannel id. Some use rs have an existing foreground-service and NotificationChannel so wish to have the plugin's foreground-service s share the same notification and channel. This option should generally not be used.
- [Android] Add permission
android.permission.POST_NOTIFICATIONSfor Android 13 (targetSdkVersion 33). Requ ired to allow enabling notifications in Settings->Apps. - [Android] Add new Config option
Authorization.refreshHeadersfor full control over HTTP headers sent toAuthorization.refreshUrlwhen refreshing auth token. - [Android] Add
nullcheck when executingPowerManager.isPowerSaveMode() - [Android] Add new
Config.disableProviderChangeRecord (default false)to allow disabling the automatical HTTP POST of theonProviderChangelocation record. Some users do not want this automatically uploaded locatio n whenever the state of location-services is changed (eg: Location-services disabled, Airplane mode, etc). - [Android] Fix bug with
disableMotionActivityUpdates: trueand calling.start()followed immediately by.changePace(true). The SDK would fail to enter the moving state, entering the stationary state instead.
4.7.2 — 2022-09-06 #
- Add new iOS 15
CLLocationattributeLocation.ellipsoidal_altitudeThe altitude as a height above the World Geodetic System 1984 (WGS84) ellipsoid, measured in meters. AndroidLocation.altitudehas always returned ellipsoidal altutude, so bothLocation.altitudeandLocation.ellipsoidal_altitudewill return the same value.
4.7.1 — 2022-08-08 #
- [Android] Fix
java.lang.IllegalArgumentExceptionTSProviderManager.handleProviderChangeEvent`. - [Android]
startOnBoot: falsewithstopOnTerminate: falsecould start-on-boot. - [Android]
State.enabledreturned by calling.stop()returnstruedue to implementation running in a background-thread butcallbackexecuted immediately on the main-thread. However, requesting.stateimmediately after calling.stopwould return the correct value ofState.enabled. - [Android] Fix
notification.stickynot being respected.
4.7.0 — 2022-06-21 #
- [Android] Fix bug in
onProviderChangeevent: not properly detecting when location-services disabled. - [Android] Android 12: Guard
Context.startForegroundServicewithtry / catch: the plugin will now catch exceptionForegroundServiceStartNotAllowedExceptionand automatically retry with anAlarmManageroneShot event. - [Android] Android 12: Refactor foreground-service management for Android 12: A way has been found to restore the traditional behaviour of foreground-services, allowing them to stop when no longer required (eg: where the plugin is in the stationary state).
- [Android] Refactor application life-cycle management. Remove deprecated permission
android.permission.GET_TASKStraditionally used for detecting when the app has been terminated. The new life-cycle mgmt system can detect Android headless-mode in a much more elegant manner. - [Android] Better handling for
WhenInUsebehaviour: The plugin will not allow.changePace(true)to be executed when the app is in the background (since Android forbids location-services to initiated in the background withWhenInUse). - [Android] Refactor
useSignificantChangesOnlybehaviour. Will use a defaultmotionTriggerDelaywith minimum 60000ms, minimumdistanceFilter: 250and enforcedstopTimeout: 20. - [iOS] iOS 15 has finally implemented Mock Location Detection.
location.mockwill now be present for iOS when the location is mocked, just like Android.
4.6.3 — 2022-05-27 #
- [Android] Fix bug in Android 12 support for executing
.start()in background while terminated. UsedJobSchedulerONESHOT instead ofAlarmManager. - [Android] Plugin could be placed into an infinite loop requesting motionchange position in some cases.
- [Android] Address
ConcurrentModificationExceptioninonPermissionGranted.
4.6.2 — 2022-05-11 #
- [Android] Fix issue device reboot behaviour related to change in
4.6.1for Android 11. Could produce multiple motionchange requests after airplane-mode togged off after reboot.
4.6.1 — 2022-05-11 #
- [Android] If on device reboot location-services fails to provide a location (eg: timeout, airplane mode), the plugin would rely on motion API events to try again. This is a problem if the motion api is disabled. Instead, the SDK will keep trying to retrieve a location.
- [Android] Android 12 support for
ForegroundServiceStartNotAllowedException: immediately launch the SDK'sTrackingServiceas soon as.start()executes. If a location-timeout occurs while fetching the onMotionChange position after device reboot withstartOnBoot: true, theForegroundServiceStartNotAllowedExceptioncould be raised. - [Android] Add two new attributes
android:enabledandandroid:permissionto the SDK's built-inBootReceiver:
<receiver android:name="com.transistorsoft.locationmanager.BootReceiver" android:enabled="true" android:exported="false" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
4.6.0 — 2022-05-06 #
- [Android] Android 12 support for executing
.start()and.getCurrentPosition()while the plugin is disabled and in the background. This is a bypass of new Android 12 restrictions for starting foreground-services in the background by taking advantage of AlarmManager.
Fatal Exception: android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service
4.5.0 — 2022-04-29 #
- [Android] Add a few extra manufacturer-specific
IntentforDeviceSettings.showPowerManager(). - [Android] Minimum
compileSdkVersion 31is now required. - [Android] Now that a minimum
targetSdkVersion 29is required to release an Android app to Play Store, the SDK'sAndroidManifestnow automatically appliesandroid:foregroundServiceType="location"to all requiredServicedeclarations. You no longer need to manually provide overrides in your ownAndroidManifest, ie:
<manifest>
<application>
- <service android:name="com.transistorsoft.locationmanager.service.TrackingService" android:foregroundServiceType="location" />
- <service android:name="com.transistorsoft.locationmanager.service.LocationRequestService" android:foregroundServiceType="location" />
</application>
</manifest>
4.4.0 — 2022-03-30 #
- [Android] Upgrade
android-permissionsdependency from 0.1.8 -> 2.1.6. - [iOS] Rebuild
TSLocationManager.xcframeworkwith XCode 13.3
4.3.5 — 2022-03-29 #
- Config.authorization: append Config.headers with request to refreshUrl
4.3.4 — 2022-02-16 #
- [Android] While testing adding 20k geofences, the Logger can cause an
OutOfMemoryerror. Define a dedicated thread executorExecutors.newFixedThreadPool(2)for posting log messages in background. - [iOS] remote event-listeners in onAppTerminate to prevent onEnabledChange event being fired in a dying app configured for
stopOnTerminate: true
4.3.3 — 2022-01-19 #
- [Fixed][iOS] Regression bug in iOS SAS authorization strategy
- [Fixed][Android] logLevel not defaulting to LOG_LEVEL_OFF on first install.
- [Fixed][Android] Some device report that locationAuthorizationAlert is not auto-hiding the invisible TSLocationManagerActivity in some cases.
- [Changed] Provide default values for Location parameters defined as
late(Location.event, Location.mock). Location.event will be empty-string when there is no corresponding event.
4.3.2 — 2021-11-24 #
- [Fixed][iOS} iOS Config.authorization did not allow http response status 201
4.3.1 — 2021-10-01 #
- [Fixed][Android] Android custom layout (
Config.notification.layout) events not working in Headless mode. - [Fixed] Fix to
reset:falsebehaviour. When.ready()was called a 2nd time, the plugin would apply the config anyway, bypassingreset:false. - [Added] New
Authorization.strategy "SAS"(alternative to defaultJWT).
4.3.0 — 2021-09-13 #
- [Added][Android] Implement new Android 12 "reduced accuracy" mechanism
requestTemporaryFullAccuracy.
4.2.3 — 2021-07-02 #
- [Fixed][iOS]
Authorization.refreshPayload refreshTokenwas not performing a String replace on the{refreshToken}template, instead over-writing the entire string. Eg: if provided with'refresh_token': 'Bearer {refreshToken},Bearerwould be over-written and replaced with only the refresh-token.
4.2.2 — 2021-07-01 #
- [Fixed][Android] Fixed crash reported by Huawei device, where verticalAccuracy returns NaN.
- [Fixed][iOS] add config change listeners for
heartbeatIntervalandpreventSuspendto dynamically update interval when changed withsetConfig.
4.2.1 — 2021-08-03 #
- [Changed][Android] Revert default
okHttpVersionback to3.12.13.4.xrequiresminSdkVersion 21(Android 5).
4.2.0 — 2021-08-02 #
- [Changed][Android] Update Android default
okhttpversion to4.9.1. - [Changed][Android] Update Android
eventbusto3.2.0. - [Changed][Android] Update Android
android-permissionsto import from MavenCentral instead of deprecatedjCenter. - [Changed][iOS] Re-compile iOS
TSLocationManagerusing XCode 12.4 instead of12.5.1. - [Fixed][Android] Fix an edge-case requesting motion permission. If
getCurrentPosition()is executed before.start(), the Android SDK fails to request motion permission.
4.0.2 — 2021-06-11 #
- [Fixed][iOS] Reports 2 reports of iOS crash
NSInvalidArgumentException (TSLocation.m line 178)with iOS 14 .x. Wrap JSON serialization in @try/@catch block. iOS JSON serialization docs state the supplied NSError err or ref should report problems but it seems this is only "sometimes" now.
4.0.1 — 2021-06-09 #
- Same as previous version. Simply performed flutter format on dart code to satisfy dart analyzer on pub.dev
4.0.0 — 2021-06-09 #
- Release nullsafety version as 4.0.0.
- [Changed] Add extra logic block to isMainActivityActive to compare launchActivity with baseActivity className
4.0.0-nullsafety.7 — 2021-06-07 #
- [Changed]
Config.authorizationwill perform regexp on the received response, searching for keys such asaccessToken,access_token,refreshToken,refresh_token, rather than performing regexp on the data itself.
4.0.0-nullsafety.6 — 2021-04-26 #
- [Fixed] Nullsafety casting bug in
DeviceInfo,DeviceSettings.
4.0.0-nullsafety.5 — 2021-04-22 #
- [Fixed][Android] Fix threading issue
ConcurrentMmodificationExceptioninTSConfig.
4.0.0-nullsafety.4 — 2021-04-20 #
- [Fixed][Android] Don't synchronize access to ThreadPool. Addresses ANR issues
- [Fixed]
DeviceSettings_CastError (type 'Future<dynamic>' is not a subtype of type 'FutureOr<bool>' in type cast)
4.0.0-nullsafety.3 — 2021-04-19 #
- [Fixed][Android] Implmementing State.didDeviceReboot in previous version introduced a source of ANR due time required to generate and persist JSON Config. Solution is to simply perform in Background-thread.
4.0.0-nullsafety.2 — 2021-04-08 #
- [Added] New
StateparamState.didDeviceReboot, signals if the device was rebooted. - [Added] Added new
locationTemplatepropertytimestampMeta.
4.0.0-nullsafety.1 — 2021-04-01 #
- [Fixed][Android] Flutter 2 breaks Android Headless mode with null-pointer exception.
4.0.0-nullsafety.0 — 2021-03-22 #
- [Added] Dart nullsafety.
2.1.0 — 2021-06-07 #
- [Changed]
Config.authorizationwill perform regexp on the received response, searching for keys such asaccessToken,access_token,refreshToken,refresh_token.
2.0.5 — 2021-04-21 #
- [Fixed][Android] Fix threading issue
ConcurrentMmodificationExceptioninTSConfig
2.0.4 — 2021-04-20 #
- [Fixed][Android] Don't synchronize access to ThreadPool. Addresses ANR issues.
2.0.3 — 2021-04-18 #
- [Fixed][Android] Implmementing State.didDeviceReboot in previous version introduced a source of ANR due time required to generate and persist JSON Config. Solution is to simply perform in Background-thread.
2.0.2 — 2021-04-08 #
- [Added] New
StateparamState.didDeviceReboot, signals if the device was rebooted. - [Added] Added new
locationTemplatepropertytimestampMeta.
2.0.1 — 2021-03-29 #
- [Fixed][Android] Flutter 2 did something to break Headless registration.
2.0.0 — 2021-03-16 #
- [Changed][iOS] Migrate
TSLocationManager.frameworkto new.xcframeworkfor MacCatalyst support with new Apple silcon.
⚠️ Breaking Change: Requires cocoapods >= 1.10+. #
iOS' new .xcframework requires cocoapods >= 1.10+:
$ pod --version
// if < 1.10.0
$ sudo gem install cocoapods
⚠️ Breaking Change: background_fetch. #
1.11.1 — 2021-02-17 #
- [Fixed][iOS]
startOnBoot: falsewas not being respected. - [Fixed][Android] If multiple simultaneous calls to
getCurrentPositionare executed, the location permission handler could hang and not return, causing neithergetCurrentPositionrequest to execute.
1.11.0 — 2021-01-26 #
- [Changed] Remove
Config.encryptfeature. This feature has always been flagging a Security Issue with Google Play Console and now the iOSTSLocationManageris being flagged for a virus by Avast MacOS:Pirrit-CS[PUP]. This seems to be a false-positive due to importing RNCryptor package. - [Fixed][Android] If
stopAfterElapsedMinuteswas configured with a value greater-thanstopTimeout, the event would fail to fire.
1.10.3 — 2020-11-05 #
- [Fixed][iOS] Fix issue with iOS buffer-timer with requestPermission. Could execute callback twice.
1.10.2 — 2020-11-03 #
- [Fixed][iOS] When requesting
WhenInUselocation permission, if user grants "Allow Once" then you attempt to upgrade toAlways, iOS simply does nothing and therequestPermissioncallback would not be called. Implemented a500msbuffer timer to detect if the iOS showed a system dialog (signalled by the firing ofWillResignActivelife-cycle notification). If the app does notWillResignActive, the buffer timer will fire, causing the callback torequestPermissionto fire. - [Fixed][Android] Issue with
requestPermissionnot showingbackgroundPermissionRationaledialog ontargetSdkVersion 29when usinglocationAuthorizationRequest: 'WhenInUse'followed by upgrade toAlways. - [Added] Added two new
Location.coordsattributesspeed_accuracyandheading_accuracy. - [Fixed][iOS] fix bug providing wrong Array of records to
syncmethod when no HTTP service is configured. - [Fixed][Android] Add extra logic for
isMainActivityActiveto detect whenTSLocationManagerActivityis active.
1.10.1 — 2020-09-30 #
- [Fixed][Android]
isMainActivityActivereported incorrect results for Android apps configured with "product flavors". This would cause the SDK to fail to recognize app is in "headless" state and fail to transmit headless events. - [Added][Android]
Location.coords.altitudeAccuracywas not being returned. - [Added][Android] Android 11
targetSdkVersion 30support for new Android background location permission with newConfig.backgroundLocationRationale. Android 11 has changed location authorization and no longer offers the[Allow all the time]button on the location authorization dialog. Instead, Android now offers a hook to present a custom dialog to the user where you will explain exactly why you require "Allow all the time" location permission. This dialog can forward the user directly to your application's Location Permissions screen, where the user must explicity authorize[Allow all the time]. The Background Geolocation SDK will present this dialog, which can be customized withConfig.backgroundPermissionRationale.

BackgroundGeolocation.ready(Config(
locationAuthorizationRequest: 'Always',
backgroundPermissionRationale: PermissionRationale(
title: "Allow access to this device's location in the background?",
message: "In order to allow X, Y and Z in the background, please enable 'Allow all the time' permission",
positiveAction: "Change to Allow all the time",
negativeAction: "Cancel"
)
));
- [Fixed][iOS] Add intelligence to iOS preventSuspend logic to determine distance from stationaryLocation using configured stationaryRadius rather than calculated based upon accuracy of stationaryLocation. If a stationaryLocation were recorded having a poor accuracy (eg: 1000), the device would have to walk at least 1000 meters before preventSuspend would engage tracking-state.
- [Fixed][Android] Android LocationRequestService, used for getCurrentPosition and motionChange position, could remain running after entering stationary state if a LocationAvailability event was received before the service was shut down.
- [Fixed][iOS] Ignore didChangeAuthorizationStatus events when disabled and no requestPermissionCallback exists. The plugin could possibly respond to 3rd-party permission plugin events.
1.10.0+1 — 2020-08-21 #
- [Docs] Improve docs for
Locationclass; adding missing docs forCoords,Battery,Activity.
1.10.0 &mdash 2020-08-20 #
- [Added][iOS] iOS 14 introduces a new switch on the initial location authorization dialog, allowing the user to "disable precise location". In support of this, a new method
BackgroundGeolocation.requestTemporaryFullAccuracyhas been added for requesting the user enable "temporary high accuracy" (until the next launch of your app), in addition to a new attributeProviderChangeEvent.accuracyAuthorizationfor learning its state in the eventonProviderChange:
void _onProviderChange(bg.ProviderChangeEvent event) async {
print("[providerchange] - $event");
// Did the user disable precise locadtion in iOS 14+?
if (event.accuracyAuthorization == bg.ProviderChangeEvent.ACCURACY_AUTHORIZATION_REDUCED) {
// Supply "Purpose" key from Info.plist as 1st argument.
bg.BackgroundGeolocation.requestTemporaryFullAccuracy("DemoPurpose").then((int accuracyAuthorization) {
if (accuracyAuthorization == bg.ProviderChangeEvent.ACCURACY_AUTHORIZATION_FULL) {
print("[requestTemporaryFullAccuracy] GRANTED: $accuracyAuthorization");
} else {
print("[requestTemporaryFullAccuracy] DENIED: $accuracyAuthorization");
}
}).catchError((error) {
print("[requestTemporaryFullAccuracy] FAILED TO SHOW DIALOG: $error");
});
}
}
These changes are fully compatible with Android, which will always return ProviderChange.ACCURACY_AUTHORIZATION_FULL
- [Added][Android] Add
onChangelistener forconfig.locationAuthorizationRequestto request location-authorization. - [Changed][iOS] If
locationAuthorizationRequest: 'WhenInUse'and the user has granted the higher level ofAlwaysauthorization, do not showlocationAuthorizationAlert. - [Added][iOS] Apple has changed the behaviour of location authorization — if an app initially requests
When In Uselocation authorization then later requestsAlwaysauthorization, iOS will immediately show the authorization upgrade dialog ([Keep using When in Use] /[Change to Always allow]). - [Changed][iOS] When
locationAuthorizationRequest: 'Always', the SDK will now initially requestWhenInUsefollowed immediately with another request forAlways, rather than having to wait an unknown length of time for iOS to show the authorization upgrade dialog:
Example
await bg.BackgroundGeolocation.ready(bg.Config(
locationAuthorizationRequest: 'WhenInUse'
));
//
// some time later -- could be immediately after, hours later, days later, etc.
//
// Simply update config to "Always" -- iOS will automatically show the authorization upgrade dialog.
await bg.BackgroundGeolocation.setConfig(bg.Config(
locationAuthorizationRequest: 'Always'
));

- [Fixed][Android] Extras provided with a
ListofMapfail to recursively convert the Map to JSON, eg:
BackgroundGeolocation.ready(bg.Config(
extras: {
"foo": [{ // <-- List of Map won't be converted to JSON
"foo": "bar"
}]
}
))
- [Fixed][iOS] when
getCurrentPositionis provided withextras, thoseextrasoverwrite any configuredConfig.extrasrather than merging. - [Fixed][Android] When cancelling Alarms, use
FLAG_UPDATE_CURRENTinstead ofFLAG_CANCEL_CURRENT-- there are reports of older Samsung devices failing to garbadge-collect Alarms, causing the number of alarms to exceed maximum 500, generating an exception.
1.9.3 - 2020-07-16 #
- No changes from
1.9.2. This version is merely a bump to satisfy pub.dev penalty for placing http urls in README instead of https.
1.9.2 - 2020-07-08 #
- [Added][Android] New Config option
Notification.sticky(defaultfalse) for allowing the Android foreground-service notification to be always shown. The default behavior is the only show the notification when the SDK is in the moving state, but Some developers have expressed the need to provide full disclosure to their users when the SDK is enabled, regardless if the device is stationary with location-services OFF. - [Added] Support for providing a native "beforeInsert" block in iOS
AppDelegate.mand AndroidApplication.java/Application.kt. The returned object will be inserted into the SDK's SQLite database and uploaded to yourConfig.url. iOSAppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
// [OPTIONAL] This block is called before a location is inserted into the background_geolocation SQLite database.
// - The returned NSDictionary will be inserted.
// - If you return nil, no record will be inserted.
TSLocationManager *bgGeo = [TSLocationManager sharedInstance];
bgGeo.beforeInsertBlock = ^NSDictionary *(TSLocation *tsLocation) {
CLLocation *location = tsLocation.location;
NSLog(@"[beforeInsertBlock] %@: %@", tsLocation.uuid, location);
// Return a custom schema or nil to cancel SQLite insert.
return @{
@"lat": @(location.coordinate.latitude),
@"lng": @(location.coordinate.longitude),
@"battery": @{
@"level": tsLocation.batteryLevel,
@"is_charging": @(tsLocation.batteryIsCharging)
}
};
};
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
Android Application.java
public class Application extends FlutterApplication {
@Override
public void onCreate() {
super.onCreate();
BackgroundGeolocation.getInstance(this).setBeforeInsertBlock(new TSBeforeInsertBlock() {
@Override
public JSONObject onBeforeInsert(TSLocation tsLocation) {
Location location = tsLocation.getLocation();
JSONObject json = new JSONObject();
JSONObject battery = new JSONObject();
try {
json.put("lat", location.getLatitude());
json.put("lng", location.getLongitude());
battery.put("level", tsLocation.getBatteryLevel());
battery.put("is_charging", tsLocation.getBatteryIsCharging());
json.put("battery", battery);
return json;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
});
}
}
1.9.1 - 2020-07-02 #
- [Fixed][iOS] Geofence
EXITsometimes not firing when usingnotifyOnDwell. - [Changed][Android] Refactor geofencing-only mode to not initiate "Infinite Geofencing" when the total number of added geofences is
< 99(the maximum number of simultaneous geofences that can be monitored on Android). This prevents the SDK from periodically requesting location to query "geofences withingeofenceProximityRadius". iOS already has this behaviour (where its maximum simultaneous geofences is19). - [Fixed][iOS] When using
#readywithreset: true(the default), andautoSync: false, the SDK could initiate HTTP service if any records exist within plugin's SQLite database, sincereset: truecausesautoSync: truefor a fraction of a millisecond, initiating the HTTP Service.
1.9.0 - 2020-06-15 #
- [Fixed][Android]
com.android.tools.build:gradle:4.0.0no longer allows "direct local aar dependencies". The Android Setup now requires a custommaven urlto be added to your app's rootandroid/build.gradle:
A new step is required for Android Setup
📂 android/build.gradle:
allprojects {
repositories {
google()
jcenter()
+ maven {
+ // [required] flutter_background_geolocation
+ url "${project(':flutter_background_geolocation').projectDir}/libs"
+ }
+ maven {
+ // [required] background_fetch
+ url "${project(':background_fetch').projectDir}/libs"
+ }
}
}
You might then clean your android project:
cd android
./gradlew clean
- [Fixed][Android]
onConnectivityChangecan report incorrect value forenabledwhen toggling between Wifi Off / Airplane mode.
1.8.0 - 2020-05-28 #
- [Fixed][Android]
onGeofenceevent-handler fails to be fired whenmaxRecordsToPersist: 0. - [Fixed][Android]
requestPermissionmethod was always returningAUTHORIZATION_STATUS_ALWAYSeven when When in Use was selected. - [Fixed]
insertLocationexception (issue #220) - [Fixed][iOS] When using
disableStopDetection: truewithpausesLocationUpdatesAutomatically: true, theCLLocationManagerDelegate didPauseLocationUpdatesfired amotionchangewithisMoving: true(should befalse). - [Fixed][Android] Fix
@UIThreadissue executing location error handler on background-thread. - [Changed][Android] Gradle import
tslocationmanagerusingapiinstead ofimplementationin order to allow overriding SDK'sAndroidManifestelements (eg:<service>elements). - [Fixed][iOS] When upgrading from a version previous
<1.4.0, if any records exist within plugin's SQLite database, those records could fail to be properly migrated to new schema. - [Added] New method
BackgroundGeolocation.destroyLocation(uuid)for destroying a single location byLocation.uuid. - [Changed] Android library
tslocationmanager.aaris now compiled usingandroidx. For backwards-compatibility with those how haven't migrated toandroidX, a reverse-jetified build is included. Usage is detected automatically based uponandroid.useAndroidXin one'sgradle.properties. - [Fixed] Allow firebase-adapter to validate license flavors on same key (eg: .development, .staging).
- [Fixed][iOS] iOS geofence listeners on
onGeofencemethod could possibly fail to be called when a geofence event causes iOS to re-launch the app in the background (this would not prevent the plugin posting the geofence event to yourConfig.url, only a failure of the dartonGeofenceto be fired).
1.7.3 - 2020-04-14 #
- [Fixed] [iOS] Bug in Logger methods. Args are received in native side with NSArray, not NSDictionary
1.7.2 - 2020-04-08 #
- [Added] [Android] Add new
Config.motionTriggerDelay (milliseconds)for preventing false-positive triggering of location-tracking (while walking around one's house, for example). If the motion API triggers back tostillbeforemotionTriggerDelayexpires, triggering to the moving state will be cancelled. - [Fixed] Address issue with rare reports of iOS crashing with error referencing
SOMotionDetector.m. - [Fixed] Odometer issue with Android/iOS: Do not persist
lastOdometerLocationwhen plugin is disabled.
1.7.1 - 2020-03-20 #
- [Added] [Android] Add an boolean extra
TSLocationManager: trueto the launch Intent of the foreground-notification, allowing application developers to determine when their app was launched due to a click on the foreground-notification. - [Fixed]
Authorizationbug in refresh-url response-data recursive iterator. Do not recurse into arrays in token-refresh response from server (tokensare not likely to be found there, anyway). - [Added] iOS
Config.showsBackgroundLocationIndicator, a Boolean indicating whether the status bar changes its appearance when an app uses location services in the background.
1.7.0 - 2020-02-21 #
- [Fixed] iOS bug related to significant-location-changes (SLC) API. In a previous version, the plugin's geofence manager would stop monitoring SLC if the number of added geofences was < the maximum (20) (in order to not show the new iOS 13 dialog reporting background location usage when infinite-geofencing is not required). The background-geolocation SDK uses several
CLLocationManagerinstances and itsGeofenceManagermaintains its own instance. However, it turns out that when anyCLLocationManagerinstance stops monitoring the SLC API, then ALL instances stop monitoring SLC, which is highly unexpected and undocumented. As a result, the plugin would lose its safety mechanism should the stationary geofence fail to trigger and iOS tracking could fail to start in some circumstances. - [Fixed]
synchronizemethods inTSLocationManagerto address Android NPE related tobuildTSLocation. - [Fixed] iOS: Bug in
accessTokenRegExp in Authorization token-refresh handler.
⚠️ Breaking Change: background_fetch: #
- [Changed] Reference background_fetch dependency @ 0.5.3 with new iOS 13 BGTaskScheduler API. See Updated iOS Setup.
1.6.1 - 2020-01-17 #
- [Added] Implement four new RPC commands
addGeofence,removeGeofence,addGeofences,removeGeofences. Document available RPC commands in "HttpGuide".
1.6.0 - 2020-01-14 #
- [Changed] iOS: Prefix FMDB method-names
databasePool->ts_databasePoolafter reports of apps being falsely rejected by Apple for "private API usage". - [Fixed] Android: Ensure that
location.hasSpeed()before attempting to use it for distanceFilter elasticity calculations. There was a report of a Device returningNanfor speed. - [Fixed] Android: Do not throttle http requests after http connect failure when configured with
maxRecordsToPersist. - [Fixed] Android: Respect
disableLocationAuthorizationAlertfor all cases, includinggetCurrentPosition. - [Changed] Android: Modify behaviour of geofences-only mode to not periodically request location-updates. Will use a stationary-geofence of radius geofenceProximityRadius/2 as a trigger to re-evaluate geofences in proximity.
- [Changed] Authorization refreshUrl will post as application/x-www-form-urlencoded instead of form/multipart
- [Changed] iOS geofencing mode will not engage Significant Location Changes API when total geofence count <= 18 in order to prevent new iOS 13 "Location summary" popup from showing frequent location access.
- [Fixed] Android: Add hack for older devices to fix "GPS Week Rollover" bug where incorrect timestamp is recorded from GPS (typically where year is older by 20 years).
- [Fixed] When determining geofences within
geofenceProximityRadius, add thelocation.accuracyas a buffer against low-accuracy locations. - [Changed] Increase default
geofenceProximityRadius: 2000.
1.5.0 - 2019-12-18 #
- [Changed] Upgrade to new Flutter "V2" Plugin API. See Upgrading pre 1.12 Android Projects. No extra steps required for "Android Headless Mode", it's all automatic now.
- [Changed] Modified Android Foreground Service intent to not restart activity on click.
1.4.5 - 2019-12-12 #
- [Changed] Upgrade iOS CocoaLumberjack dependency to ~>3.6.0 from ~>3.5.0. It seems some other dependency out there is using CocaoLumberjack@3.6.0.
- [Changed] Fixed example app: flutter_map is messed up again. Find another fork that works with lastest flutter api.
1.4.4 - 2019-12-12 #
- [Fixed] Previous Android version 1.4.3 was corrupted due to two copies of
tslocationmanager.aarbeing deployed.
1.4.3 - 2019-12-09 #
- Rename folder docs -> help to satisfy dartdoc on pub.dev (API docs were missing).
1.4.2 - 2019-12-03 #
- [Fixed] iOS crash when launching first time
-[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: authorization)' - [Changed] Remove Android warning
In order to enable encryption, you must provide the com.transistorsoft.locationmanager.ENCRYPTION_PASSWORDwhen usingencrypt: false. - [Fixed] Added headless implementation for
geofenceschangeevent.
1.4.1 - 2019-12-02 #
- [Fixed] Android bug rendering
Authorization.toJsonwhen noConfig.authorizationdefined.
1.4.0 - 2019-12-02 #
- [Added] New
Config.authorizationoption for automated authorization-token support. If the SDK receives an HTTP response status401 Unauthorizedand you've provided anauthorizationconfig, the plugin will automatically send a request to your configuredrefreshUrlto request a new token. The SDK will take care of adding the requiredAuthorizationHTTP header withBearer accessToken. In the past, one would manage token-refresh by listening to the SDK'sonHttplistener for HTTP401. This can now all be managed by the SDK by providing aConfig.authorization. - [Added] Implemented strong encryption support via
Config.encrypt. When enabled, the SDK will encrypt location data in its SQLite datbase, as well as the payload in HTTP requests. See API docsConfig.encryptfor more information, including the configuration of encryption password. - [Added] New JSON Web Token API for the Demo server at http://tracker.transistorsoft.com. It's now easier than ever to configure the plugin to post to the demo server. See API docs
Config.transistorAuthorizationToken. The old method usingConfig.deviceParamsis now deprecated. - [Added] New
DeviceInfomodule for providing simple device-info (model,manufacturer,version,platform). - [Removed] The SDK no longer requires the dependency
device_info.
1.3.3 - 2019-10-31 #
- [Added] New HTTP config
disableAutoSyncOnCellular. Settrueto allowautoSynconly when device is connected to Wifi. - [Changed] Re-factor iOS HTTP Service to be more robust; Replace deprecated
NSURLConnectionwithNSURLSession.
1.3.2 - 2019-10-24 #
- [Fixed] Resolve Dart analysis warnings related to
@deprecated.
1.3.1 - 2019-10-23 #
- [Fixed] Android NPE
Caused by: java.lang.NullPointerException:
at com.transistorsoft.locationmanager.service.TrackingService.b (TrackingService.java:172)
at com.transistorsoft.locationmanager.service.TrackingService.onStartCommand (TrackingService.java:135)
- [Added] new
uploadLogfeature for uploading logs directly to a server. This is an alternative toemailLog. - [Changed] Migrated logging methods
getLog,destroyLog,emailLogto newLoggermodule. See docs for more information. Existing log methods onBackgroundGeolocationare now@deprecated. - [Changed] All logging methods (
getLog,emailLoganduploadLog) now accept an optionalSQLQuery. Eg:
SQLQuery query = new SQLQuery(
start: DateTime.parse('2019-10-23 09:00'),
end: DateTime.parse('2019-10-23 19:00'),
limit: 1000,
order: SQLQuery.ORDER_ASC
);
String log = await Logger.getLog(query)
Logger.emailLog('foo@bar.com', query);
Logger.uploadLoad('http://your.server.com/logs', query);
1.3.0 - 2019-10-17 #
- [Fixed] Android: Fixed issue executing
#changePaceimmediately after#start. - [Fixed] Android: Add guard against NPR in
calculateMedianAccuracy - [Added] Add new Geofencing methods:
#getGeofence(identifier)and#geofenceExists(identifier). - [Fixed] iOS issue using
disableMotionActivityUpdates: falsewithuseSignificantChangesOnly: trueandreset: true. Plugin will accidentally ask for Motion Permission. - [Fixed] Resolved a number of Android issues exposed by booting the app in StrictMode. This should definitely help alleviate ANR issues related to
Context.startForegroundService. - [Added] Android now supports
disableMotionActivityUpdatesfor Android 10 which now requires run-time permission for "Physical Activity". Setting totruewill not ask user for this permission. The plugin will fallback to using the "stationary geofence" triggering, like iOS. - [Changed] Android: Ensure all code that accesses the database is performed in background-threads, including all logging (addresses
Context.startForegroundServiceANR issue). - [Changed] Android: Ensure all geofence event-handling is performed in background-threads (addresses
Context.startForegroundServiceANR issue). - [Added] Android: implement logic to handle operation without Motion API on Android 10. v3 has always used a "stationary geofence" like iOS as a fail-safe, but this is now crucial for Android 10 which now requires run-time permission for "Physical Activity". For those users who [Deny] this permission, Android will trigger tracking in a manner similar to iOS (ie: requiring movement of about 200 meters). This also requires handling to detect when the device has become stationary.
1.2.4 - 2019-09-20 #
- [Fixed] flutter@1.9.1 deprecated a method
FlutterMain.findBundleAppPath(Context), replacing with a new signature the receives noContext. Changing to the new signature breaks people using < flutter 1.9.1. Will use old signature for now. - [Fixed] Custom layouts were not working properly for older OS version < O. Custom layout will use setBigContentLayout now. The user will be able to expand the notification to reveal the custom layout.
1.2.3 - 2019-09-16 #
- [Changed] Bump background_fetch version to 0.3.0
- [Changed] Android: move more location-handling code into background-threads to help mitigate against ANR referencing
Context.startForegroundService - [Changed] Android: If BackgroundGeolocation adapter is instantiated headless and is enabled, force ActivityRecognitionService to start.
- [Added] Add
mocktolocationTemplatedata. - [Added] Android now adds 2 extra setup steps. (1) The plugin now hosts its own
proguard-rules.prowhich must be manually added toapp/build.gradle. (2) The plugin now hosts its own custom gradle file which must also be manuallyapply fromin yourapp/build.gradle. This extra gradle file contains a simple method to strip the SDK's debug sound-effects from your release build (1.5M):
android/app/build.gradle
📂 android/app/build.gradle:
// flutter_background_geolocation
+Project background_geolocation = project(':flutter_background_geolocation')
// 1. Extra gradle file
+apply from: "${background_geolocation.projectDir}/background_geolocation.gradle"
android {
.
.
.
buildTypes {
release {
.
.
.
minifyEnabled true
// 2. background_geolocation requires custom Proguard Rules when used with minifyEnabled
+ proguardFiles "${background_geolocation.projectDir}/proguard-rules.pro"
}
}
}
1.2.2 - 2019-09-05 #
- [Changed] Rebuild iOS
TSLocationManager.frameworkwith XCode 10 (previous build used XCode 11-beta6). Replace@availablemacro withSYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO. - [Fixed] iOS 13 preventSuspend was not working with iOS 13. iOS has once again decreased the max time for UIApplication beginBackgroundTask from 180s down to 30s.
- [Fixed] Android
Geofences.extrasnot being provided to#onGeofencesChangeevent (issue #110). - [Fixed] iOS 10 provides
boolattributes asintinState. CheckruntimeType == int. Issue #111. - [Changed] Upgrade
android-logbackdependency to2.0.0 - [Changed] Android: move some plugin initialization into background-threads (eg:
performLogCleanup) to help mitigate against ANR "Context.startForegroundServicedid not then callService.startForeground".
1.2.1 - 2019-08-22 #
- [Fixed] Android Initial headless events can be missed when app booted due to motion transition event.
- [Fixed] Android crash with EventBus
Subscriber already registered error. - [Fixed] iOS
Crash: [TSHttpService postBatch:error:] + 6335064 (TSHttpService.m:253)
1.2.0 - 2019-08-17 #
- [Added] iOS 13 support.
1.1.0 - 2019-08-07 #
- [Fixed] Android Geofence
DWELLtransition (notifyOnDwell: true) not firing. - [Fixed] iOS
logMaxDayswas hard-coded to7; Config option not being respected. - [Added] Android
Qsupport (API 29) with new location permission modelWhen In Use. Android now supports the config optionlocationAuthorizationRequestwhich was traditionally iOS-only. Also, Android Q now requires runtime permission from user forACTIVITY_RECOGNITION. - [Changed] Another Android tweak to mitigate against error
Context.startForegroundService() did not then call Service.startForeground(). - [Changed] Add new Android gradle config parameter
appCompatVersionto replacesupportLibVersionfor better AndroidX compatibility. IfappCompatVersionis not found, the plugin's gradle file falls back to oldsupportLibVersion.
1.0.12 - 2019-07-23 #
- [Fixed] Found a few more cases where Android callbacks are being executed in background-thread. References issue #70.
1.0.11 - 2019-07-10 #
- [Fixed] Android issue running enabledchange event in background-thread with flutter 1.7
1.0.10 - 2019-06-25 #
- [Fixed] iOS / Android issues with odometer and
getCurrentPositionwhen used withmaximumAgeconstraint. Incorrect, old location was being returned instead of latest available. - [Fixed] Some Android methods were executing the callback in background-thread, exposed when using flutter dev channel (
#insertLocation,#getLocations,#getGeofences,#sync). - [Fixed] Add
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)toDeviceSettingsrequest for Android 9 compatibility. - [Changed] Tweaks to Android services code to help guard against error
Context.startForegroundService() did not then call Service.startForeground(). - [Fixed] iOS manual
synccrash in simulator while executing callback when error response is returned from server.
1.0.9 - 2019-06-17 #
- [Fixed] Android bug with
getCurrentPositionandmaximumAge, Fixes #80. - [Fixed] Odometer issues: clear odometer reference location on
#stop,#startGeofences. - [Fixed] Odometer issues: Android must persist its odometer reference location since the foreground-service is no longer long-lived and the app may be terminated between motionchange events.
- [Fixed] Return
Service.START_REDELIVER_INTENTfromHeartbeatService. Fixes #79 to preventnullIntent being delivered toHeartbeatService. - [Added] Implement Android LocationSettingsRequest. Determines if device settings is currently configured according to the plugin's desired-settings (eg: gps enabled, location-services enabled). If the device settings differs, an automatic dialog will perform the required settings changes automatically when user clicks [OK].
- [Fixed] Android
triggerActivitieswas not implemented refactor of1.x.
1.0.8 - 2019-06-04 #
- [Fixed] Android
destroyLocationscallback was being executed in background-thread. - [Fixed] When Android geofence API receives a
GEOFENCE_NOT_AVAILABLEerror (can occur is Wifi is disabled), geofences must be re-registered. - [Fixed] Android
Config.disableStopDetectionwas not implemented.
1.0.7 - 2019-05-13 #
- [Fixed] Android issue with Firebase Adapter support not working when app is terminated.
1.0.6 - 2019-05-12 #
- [Added] New Android config
Config.scheduleUseAlarmManagerto force Android scheduler to use more preciseAlarmManagerinstead ofJobScheduler. - [Added] Support for background_geolocation_firebase adapter.
1.0.5 - 2019-05-10 #
- [Changed] Rollback
android-permissionsversion back to0.1.8. It relies onsupport-annotations@28. This isn't a problem if one simply upgrades theirtargetSdkVersionbut the support calls aren't worth the hassle, since the latest version doesn't offer anything the plugin needs.
1.0.4 - 2019-05-09 #
- [Changed] Update docs.
1.0.3 - 2019-05-08 #
- [Fixed] Dart analysis warnings, re: initializing null values in new Notification class.
1.0.2 - 2019-05-08 #
- [Fixed] iOS: changing
pauseslocationUpdatesAutomaticallywas not being applied. - [Changed]
resetparameter provided to#readyhas now been default totrue. This causes too many support issues for people using the plugin the first time. - [Fixed] Android threading issue where 2 distinct
SingleLocationRequestwere issued the same id. This could result in the foreground service quickly starting/stopping untillocationTimeoutexpired. - [Fixed] Android issue where geofences could fail to query for new geofences-in-proximity after a restart.
- [Fixed] Android issues re-booting device with location-services disabled or location-authorization revoked.
- [Added] Implement support for Custom Android Notification Layouts.
- [Fixed] Android bug where Service repeatedly stops / starts after rebooting device with plugin in moving state.
- [Fixed] Android scheduler bug. When app is terminated & restarted during a scheduled ON period, tracking-service does not restart.
- [Fixed] Android headless
heartbeatevents were failing (incorrectContextwas supplied to the event).
1.0.1 - 2019-04-09 #
- [Fixed] iOS: Incorrect return type BOOL from native method stopBackgroundTask. Should have been int.
- [Changed] Add Geofence test panel in example Settings screen. Allows to add a series of test-geofences along the iOS simulator Freeway Drive route.
1.0.0 - 2019-04-05 #
- [RELEASE] Release 1.0.0
1.0.0-rc.4 - 2019-03-31 #
- [Fixed] Android: Another
NullPointerExceptionwithBundle#getExtras.
1.0.0-rc.3 - 2019-03-29 #
- [Fixed] Android
NullPointerExceptionwithBundle#getExtras(#674). - [Fixed] Android not persisting
providerchangelocation when location-services re-enabled.
1.0.0-rc.2 - 2019-03-27 #
- [Fixed] An Android foreground-service is launched on first install and fails to stop.
1.0.0-rc.1 - 2019-03-25 #
Breaking Changes #
- [Changed] The license format has changed. New
1.0.0licenses are now available for customers in the product dashboard.
Fixes #
- [Fixed] iOS missing native
destroyLogimplementation (thanks to @joserocha3) - [Fixed] Missing Dart implementation for
requestPermissionmethod (thanks to @joserocha3) - [Fixed] Logic bugs in MotionActivity triggering between stationary / moving states.
- [Fixed] List.map Bug in Dart api
addGeofences.
New Features #
- [Added] Android implementation for
useSignificantChangesOnlyConfig option. Will request Android locations without the persistent foreground service. You will receive location updates only a few times per hour:useSignificantChangesOnly: true:
useSignificantChangesOnly: false:

-
[Added] Android now implements a "stationary geofence", just like iOS. It currently acts as a secondary triggering mechanism along with the current motion-activity API. You will hear the "zap" sound effect when it triggers. This also has the fortunate consequence of allowing mock-location apps (eg: Lockito) of being able to trigger tracking automatically.
-
[Added] The SDK detects mock locations and skips trigging the
stopTimeoutsystem, improving location simulation workflow. -
[Added] Android-only Config option
geofenceModeHighAccuracyfor more control over geofence triggering responsiveness. Runs a foreground-service during geofences-only mode (#startGeofences). This will, of course, consume more power.
await BackgroundGeolocation.ready(Config
geofenceModeHighAccuracy: true,
desiredAccuracy: Config.DESIRED_ACCURACY_MEDIUM,
locationUpdateInterval: 5000,
distanceFilter: 50
));
BackgroundGeolocation.startGeofences();
- [Added] Android implementation of
startBackgroundTask/stopBackgroundTask. This implementation uses a foreground-service. I've tried using Android'sJobServicebut these tasks are queued by the OS and run only periodically.
// an Android foreground-service has just launched (in addition to its persistent notification).
int taskId = await BackgroundGeolocation.startBackgroundTask();
// Do any work you like -- it's guaranteed to run, regardless of background/terminated.
// Your task has exactly 30s to do work before the service auto-stops itself.
// Execute an HTTP request to test an async operation.
String url = "http://tracker.transistorsoft.com/devices?company_token=$_username";
String result = await http.read(url).then((String result) {
print("[http test] success: $result");
// Terminate the foreground-service.
BackgroundGeolocation.stopBackgroundTask(taskId);
}).catchError((dynamic error) {
print("[http test] failed: $error");
// Always be sure to stop your tasks, just like iOS.
BackgroundGeolocation.stopBackgroundTask(taskId);
});
Logging for background-tasks looks like this (when you see an hourglass, a foreground-service is active)
[BackgroundTaskManager onStartJob] ⏳ startBackgroundTask: 6
.
.
.
[BackgroundTaskManager$Task stop] ⏳ stopBackgroundTask: 6
- [Added] New custom Android debug sound FX. More documentation will be added to the docs but here's a basic description from the code:
public static final String LOCATION_RECORDED = OOOOIII;
public static final String LOCATION_SAMPLE = CLICK_TAP_DONE;
public static final String LOCATION_ERROR = DIGI_WARN;
public static final String MOTIONCHANGE_FALSE = MARIMBA_DROP;
public static final String MOTIONCHANGE_TRUE = CHIME_SHORT_CHORD_UP;
public static final String STATIONARY_GEOFENCE_EXIT = ZAP_FAST;
public static final String STOP_TIMER_ON = CHIME_BELL_CONFIRM;
public static final String STOP_TIMER_OFF = BELL_DING_POP;
public static final String HEARTBEAT = PEEP_NOTE;
public static final String GEOFENCE_ENTER = BEEP_TRIP_UP_DRY;
public static final String GEOFENCE_DWELL = BEEP_TRIP_UP_ECHO;
public static final String GEOFENCE_EXIT = BEEP_TRIP_DRY;
public static final String WARNING = DIGI_WARN;
public static final String ERROR = MUSIC_TIMPANI_ERROR;
⚠️ These debug sound FX consume about 1.4MB in the plugin's tslocationmanager.aar. These assets can easily be stripped in your release builds by adding the following gradle task to your app/build.gradle (I'm working on an automated solution within the context of the plugin's build.gradle; so far, no luck). Big thanks to @mikehardy.
/**
* Purge flutter_background_geolocation debug sounds from release build.
*/
def purgeBackgroundGeolocationDebugResources(applicationVariants) {
applicationVariants.all { variant ->
if (variant.buildType.name == 'release') {
variant.mergeResources.doLast {
delete(fileTree(dir: variant.mergeResources.outputDir, includes: ['raw_tslocationmanager*']))
}
}
}
}
android {
//Remove debug sounds from background_geolocation plugin
purgeBackgroundGeolocationDebugResources(applicationVariants)
compileSdkVersion rootProject.ext.compileSdkVersion
.
.
.
}
Removed #
- [Changed] Removed Android config option
activityRecognitionInterval. The Android SDK now uses the more modern ActivityTransistionClient API which is a higher level wrapper for the traditional ActivityReconitionClient.AcitvityTransitionClientdoes not accept a pollinginterval, thusactiivtyRecognitionIntervalis now unused. Also,ActivityTransitionClientemits similaron_foot,in_vehicleevents but no longer provides aconfidence, thusconfidenceis now reported always as100. If you've been implementing your own custom triggering logic based uponconfidence, it's now pointless. TheActivityTransitionClientwill open doors for new features based upon transitions between activity states.
╔═════════════════════════════════════════════
║ Motion Transition Result
╠═════════════════════════════════════════════
╟─ 🔴 EXIT: walking
╟─ 🎾 ENTER: still
╚═════════════════════════════════════════════
Maintenance #
- [Changed] Update
android-permissionsdependency to0.1.8.