- [Fixed][Android] Don't synchronize access to ThreadPool. Addresses ANR issues.
- [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.
- [Added] New
State
paramState.didDeviceReboot
, signals if the device was rebooted. - [Added] Added new
locationTemplate
propertytimestampMeta
.
- [Fixed][Android] Flutter 2 did something to break Headless registration.
- [Changed][iOS] Migrate
TSLocationManager.framework
to new.xcframework
for MacCatalyst support with new Apple silcon.
iOS' new .xcframework
requires cocoapods >= 1.10+:
$ pod --version
// if < 1.10.0
$ sudo gem install cocoapods
- [Fixed][iOS]
startOnBoot: false
was not being respected. - [Fixed][Android] If multiple simultaneous calls to
getCurrentPosition
are executed, the location permission handler could hang and not return, causing neithergetCurrentPosition
request to execute.
- [Changed] Remove
Config.encrypt
feature. This feature has always been flagging a Security Issue with Google Play Console and now the iOSTSLocationManager
is 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
stopAfterElapsedMinutes
was configured with a value greater-thanstopTimeout
, the event would fail to fire.
- [Fixed][iOS] Fix issue with iOS buffer-timer with requestPermission. Could execute callback twice.
- [Fixed][iOS] When requesting
WhenInUse
location permission, if user grants "Allow Once" then you attempt to upgrade toAlways
, iOS simply does nothing and therequestPermission
callback would not be called. Implemented a500ms
buffer timer to detect if the iOS showed a system dialog (signalled by the firing ofWillResignActive
life-cycle notification). If the app does notWillResignActive
, the buffer timer will fire, causing the callback torequestPermission
to fire. - [Fixed][Android] Issue with
requestPermission
not showingbackgroundPermissionRationale
dialog ontargetSdkVersion 29
when usinglocationAuthorizationRequest: 'WhenInUse'
followed by upgrade toAlways
. - [Added] Added two new
Location.coords
attributesspeed_accuracy
andheading_accuracy
. - [Fixed][iOS] fix bug providing wrong Array of records to
sync
method when no HTTP service is configured. - [Fixed][Android] Add extra logic for
isMainActivityActive
to detect whenTSLocationManagerActivity
is active.
- [Fixed][Android]
isMainActivityActive
reported 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.altitudeAccuracy
was not being returned. - [Added][Android] Android 11
targetSdkVersion 30
support 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.
- [Docs] Improve docs for
Location
class; adding missing docs forCoords
,Battery
,Activity
.
- [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.requestTemporaryFullAccuracy
has been added for requesting the user enable "temporary high accuracy" (until the next launch of your app), in addition to a new attributeProviderChangeEvent.accuracyAuthorization
for 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
onChange
listener forconfig.locationAuthorizationRequest
to request location-authorization. - [Changed][iOS] If
locationAuthorizationRequest: 'WhenInUse'
and the user has granted the higher level ofAlways
authorization, do not showlocationAuthorizationAlert
. - [Added][iOS] Apple has changed the behaviour of location authorization — if an app initially requests
When In Use
location authorization then later requestsAlways
authorization, 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 requestWhenInUse
followed 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
List
ofMap
fail 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
getCurrentPosition
is provided withextras
, thoseextras
overwrite any configuredConfig.extras
rather than merging. - [Fixed][Android] When cancelling Alarms, use
FLAG_UPDATE_CURRENT
instead 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.
- 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.
- [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.m
and 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;
}
}
});
}
}
- [Fixed][iOS] Geofence
EXIT
sometimes 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
#ready
withreset: true
(the default), andautoSync: false
, the SDK could initiate HTTP service if any records exist within plugin's SQLite database, sincereset: true
causesautoSync: true
for a fraction of a millisecond, initiating the HTTP Service.
- [Fixed][Android]
com.android.tools.build:gradle:4.0.0
no longer allows "direct local aar dependencies". The Android Setup now requires a custommaven url
to 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]
onConnectivityChange
can report incorrect value forenabled
when toggling between Wifi Off / Airplane mode.
- [Fixed][Android]
onGeofence
event-handler fails to be fired whenmaxRecordsToPersist: 0
. - [Fixed][Android]
requestPermission
method was always returningAUTHORIZATION_STATUS_ALWAYS
even when When in Use was selected. - [Fixed]
insertLocation
exception (issue #220) - [Fixed][iOS] When using
disableStopDetection: true
withpausesLocationUpdatesAutomatically: true
, theCLLocationManagerDelegate didPauseLocationUpdates
fired amotionchange
withisMoving: true
(should befalse
). - [Fixed][Android] Fix
@UIThread
issue executing location error handler on background-thread. - [Changed][Android] Gradle import
tslocationmanager
usingapi
instead ofimplementation
in order to allow overriding SDK'sAndroidManifest
elements (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.aar
is 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.useAndroidX
in one'sgradle.properties
. - [Fixed] Allow firebase-adapter to validate license flavors on same key (eg: .development, .staging).
- [Fixed][iOS] iOS geofence listeners on
onGeofence
method 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 dartonGeofence
to be fired).
- [Fixed] [iOS] Bug in Logger methods. Args are received in native side with NSArray, not NSDictionary
- [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 tostill
beforemotionTriggerDelay
expires, 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
lastOdometerLocation
when plugin is disabled.
- [Added] [Android] Add an boolean extra
TSLocationManager: true
to 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]
Authorization
bug in refresh-url response-data recursive iterator. Do not recurse into arrays in token-refresh response from server (tokens
are 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.
- [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
CLLocationManager
instances and itsGeofenceManager
maintains its own instance. However, it turns out that when anyCLLocationManager
instance 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]
synchronize
methods inTSLocationManager
to address Android NPE related tobuildTSLocation
. - [Fixed] iOS: Bug in
accessToken
RegExp in Authorization token-refresh handler.
- [Changed] Reference background_fetch dependency @ 0.5.3 with new iOS 13 BGTaskScheduler API. See Updated iOS Setup.
- [Added] Implement four new RPC commands
addGeofence
,removeGeofence
,addGeofences
,removeGeofences
. Document available RPC commands in "HttpGuide".
- [Changed] iOS: Prefix FMDB method-names
databasePool
->ts_databasePool
after 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 returningNan
for speed. - [Fixed] Android: Do not throttle http requests after http connect failure when configured with
maxRecordsToPersist
. - [Fixed] Android: Respect
disableLocationAuthorizationAlert
for 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.accuracy
as a buffer against low-accuracy locations. - [Changed] Increase default
geofenceProximityRadius: 2000
.
- [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.
- [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.
- [Fixed] Previous Android version 1.4.3 was corrupted due to two copies of
tslocationmanager.aar
being deployed.
- Rename folder docs -> help to satisfy dartdoc on pub.dev (API docs were missing).
- [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_PASSWORD
when usingencrypt: false
. - [Fixed] Added headless implementation for
geofenceschange
event.
- [Fixed] Android bug rendering
Authorization.toJson
when noConfig.authorization
defined.
- [Added] New
Config.authorization
option for automated authorization-token support. If the SDK receives an HTTP response status401 Unauthorized
and you've provided anauthorization
config, the plugin will automatically send a request to your configuredrefreshUrl
to request a new token. The SDK will take care of adding the requiredAuthorization
HTTP header withBearer accessToken
. In the past, one would manage token-refresh by listening to the SDK'sonHttp
listener 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.encrypt
for 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.deviceParams
is now deprecated. - [Added] New
DeviceInfo
module for providing simple device-info (model
,manufacturer
,version
,platform
). - [Removed] The SDK no longer requires the dependency
device_info
.
- [Added] New HTTP config
disableAutoSyncOnCellular
. Settrue
to allowautoSync
only when device is connected to Wifi. - [Changed] Re-factor iOS HTTP Service to be more robust; Replace deprecated
NSURLConnection
withNSURLSession
.
- [Fixed] Resolve Dart analysis warnings related to
@deprecated
.
- [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
uploadLog
feature for uploading logs directly to a server. This is an alternative toemailLog
. - [Changed] Migrated logging methods
getLog
,destroyLog
,emailLog
to newLogger
module. See docs for more information. Existing log methods onBackgroundGeolocation
are now@deprecated
. - [Changed] All logging methods (
getLog
,emailLog
anduploadLog
) 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);
- [Fixed] Android: Fixed issue executing
#changePace
immediately 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: false
withuseSignificantChangesOnly: true
andreset: 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
disableMotionActivityUpdates
for Android 10 which now requires run-time permission for "Physical Activity". Setting totrue
will 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.startForegroundService
ANR issue). - [Changed] Android: Ensure all geofence event-handling is performed in background-threads (addresses
Context.startForegroundService
ANR 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.
- [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.
- [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
mock
tolocationTemplate
data. - [Added] Android now adds 2 extra setup steps. (1) The plugin now hosts its own
proguard-rules.pro
which must be manually added toapp/build.gradle
. (2) The plugin now hosts its own custom gradle file which must also be manuallyapply from
in 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"
}
}
}
- [Changed] Rebuild iOS
TSLocationManager.framework
with XCode 10 (previous build used XCode 11-beta6). Replace@available
macro 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.extras
not being provided to#onGeofencesChange
event (issue #110). - [Fixed] iOS 10 provides
bool
attributes asint
inState
. CheckruntimeType == int
. Issue #111. - [Changed] Upgrade
android-logback
dependency to2.0.0
- [Changed] Android: move some plugin initialization into background-threads (eg:
performLogCleanup
) to help mitigate against ANR "Context.startForegroundService
did not then callService.startForeground
".
- [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)
- [Added] iOS 13 support.
- [Fixed] Android Geofence
DWELL
transition (notifyOnDwell: true
) not firing. - [Fixed] iOS
logMaxDays
was hard-coded to7
; Config option not being respected. - [Added] Android
Q
support (API 29) with new location permission modelWhen In Use
. Android now supports the config optionlocationAuthorizationRequest
which 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
appCompatVersion
to replacesupportLibVersion
for better AndroidX compatibility. IfappCompatVersion
is not found, the plugin's gradle file falls back to oldsupportLibVersion
.
- [Fixed] Found a few more cases where Android callbacks are being executed in background-thread. References issue #70.
- [Fixed] Android issue running enabledchange event in background-thread with flutter 1.7
- [Fixed] iOS / Android issues with odometer and
getCurrentPosition
when used withmaximumAge
constraint. 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)
toDeviceSettings
request 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
sync
crash in simulator while executing callback when error response is returned from server.
- [Fixed] Android bug with
getCurrentPosition
andmaximumAge
, 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_INTENT
fromHeartbeatService
. Fixes #79 to preventnull
Intent 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
triggerActivities
was not implemented refactor of1.x
.
- [Fixed] Android
destroyLocations
callback was being executed in background-thread. - [Fixed] When Android geofence API receives a
GEOFENCE_NOT_AVAILABLE
error (can occur is Wifi is disabled), geofences must be re-registered. - [Fixed] Android
Config.disableStopDetection
was not implemented.
- [Fixed] Android issue with Firebase Adapter support not working when app is terminated.
- [Added] New Android config
Config.scheduleUseAlarmManager
to force Android scheduler to use more preciseAlarmManager
instead ofJobScheduler
. - [Added] Support for background_geolocation_firebase adapter.
- [Changed] Rollback
android-permissions
version back to0.1.8
. It relies onsupport-annotations@28
. This isn't a problem if one simply upgrades theirtargetSdkVersion
but the support calls aren't worth the hassle, since the latest version doesn't offer anything the plugin needs.
- [Changed] Update docs.
- [Fixed] Dart analysis warnings, re: initializing null values in new Notification class.
- [Fixed] iOS: changing
pauseslocationUpdatesAutomatically
was not being applied. - [Changed]
reset
parameter provided to#ready
has 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
SingleLocationRequest
were issued the same id. This could result in the foreground service quickly starting/stopping untillocationTimeout
expired. - [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
heartbeat
events were failing (incorrectContext
was supplied to the event).
- [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.
- [RELEASE] Release 1.0.0
- [Fixed] Android: Another
NullPointerException
withBundle#getExtras
.
- [Fixed] Android
NullPointerException
withBundle#getExtras
(#674). - [Fixed] Android not persisting
providerchange
location when location-services re-enabled.
- [Fixed] An Android foreground-service is launched on first install and fails to stop.
- [Changed] The license format has changed. New
1.0.0
licenses are now available for customers in the product dashboard.
- [Fixed] iOS missing native
destroyLog
implementation (thanks to @joserocha3) - [Fixed] Missing Dart implementation for
requestPermission
method (thanks to @joserocha3) - [Fixed] Logic bugs in MotionActivity triggering between stationary / moving states.
- [Fixed] List.map Bug in Dart api
addGeofences
.
- [Added] Android implementation for
useSignificantChangesOnly
Config 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
stopTimeout
system, improving location simulation workflow. -
[Added] Android-only Config option
geofenceModeHighAccuracy
for 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'sJobService
but 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;
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
.
.
.
}
- [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.AcitvityTransitionClient
does not accept a pollinginterval
, thusactiivtyRecognitionInterval
is now unused. Also,ActivityTransitionClient
emits similaron_foot
,in_vehicle
events but no longer provides aconfidence
, thusconfidence
is now reported always as100
. If you've been implementing your own custom triggering logic based uponconfidence
, it's now pointless. TheActivityTransitionClient
will open doors for new features based upon transitions between activity states.
╔═════════════════════════════════════════════
║ Motion Transition Result
╠═════════════════════════════════════════════
╟─ 🔴 EXIT: walking
╟─ 🎾 ENTER: still
╚═════════════════════════════════════════════
- [Changed] Update
android-permissions
dependency to0.1.8
.