- [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'sMainActivity
to terminate on some devices.
- [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
TSConfig
due to "uncaught exception NSInvalidArgumentException" - [Android] Change
foregroundServiceType
onLocationRequestService
fromshortService
->location
. - [iOS] Address inconsistent location-tracking performance on iOS.
- [iOS] Fix bug with
triggerActivites
preventing motion-triggering in iOS simulator with simulated location.
- [Android] Implement
Service.onTimeout
to handleforegroundServiceType="shortService"
timeouts. - [iOS] Add new
Config.activityType
ACTIVITY_TYPE_AIRBORNE
. - [iOS] Implement
Config.triggerActivities
for iOS. - [Android] Guard against
NullPointerException
receiving a null location inPolygonGeofenceService
event. - Fix crash in RPC action for
addGeofence
when adding polygon geofence. - Add two new RPC actions
setOdometer
,resetOdometer
. - [iOS] Fix broken linking to Settings screen in
locationAuthorizationAlert
on iOS 18.
- [Android] Address possible leak of
Activity
reference when terminating the app. Ensure internal reference toActivity
is nullified when app is terminated. - [Android] Add improvements to Android geofencing-only mode with
goefenceModeHighAccuracy: true
where motion-activity updates disabled. - [Android] Add error-checking in polygon-geofencing to handle a possible
NullPointerException
.
- [Expo] Fix bug in Expo plugin adding unused license keys for "polygon geofencing" with a value of
UNDEFINED
, causing license-validation error. Add logic to automatically remove license keys fromAndroidManifest
when corresponding keys are not found in yourapp.json
(eg:polygonLicense
).
- [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
notifyOnDwell
for polygon-geofences.
- [Expo] Backport Expo license-key fix from
4.17.1
.
- [Android][Expo] Conditionally add polygonLicense only if provided in Config. Do not write to AndroidManifest unless provided.
- [Android][Expo] Implement polygonLicense Config option
- [Android] Remove permission
FOREGROUND_SERVICE_HEALTH
. It turns out that this permission is no longer required whe n theActivityRecognitionServivce
is defined with aforegroundServiceType="shortservice"
, instead of"health"
, which allows a background -launched foreground-service to stay active for up to 3 minutes, which is sufficient for theActivityRecognitionServic e
, which typically stays activated only for a few milliseconds. - [Android] Fix "Multiple geofence events triggered for a single geofence registration when registered individually".
- [Android] Fix bug in .getCurrentPosition not returning or throwing an error in a condition where Network OFF and GPS ON.
- [iOS] Code-sign
TSLocationManager.xcframework
with new Apple Organization (9224-2932 Quebec Inc) certificate.
- [iOS] codesign
TSLocationManage.xcframework
- [iOS] Update
CocoaLumberjack
version ->3.8.5
(version which includes its ownPrivacyInfo
) - [iOS] Implement new iOS Privacy Manifest
- Add property
AuthorizationEvent.status
, provding the HTTP status code from therefreshUrl
.
- [iOS] Fix bug in iOS scheduler, triggering ON incorrectly. For example, given a
schedule: ['1 00:00-23:59'], the plu gin was trigging on for
DAY 2`.
- [iOS] Fix bug in polygon-geofencing: monitoredIdentifiers not being cleared when
.removeGeofences()
is called, can result in null-pointer exception. - [Android] Change
foregroundServiceType
of the SDK'sGeofencingService
definition in itsAndroidManifest
fromshortService
->location
.
- [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.
- [Expo][Android] Fix bug for Expo v50 "Invalid regular expression".
- [Android] Fix problem with polygon-geofencing license-validation not working in DEBUG builds when configured with pro duct flavors.
- [Android] HMS geolocation event does not provide a timestamp for the triggering location!! Use System current time.
- [Android] Guard against Geofence SQLite query returning null in
GeofencingService
. - [Android] Fix
ConcurrentModificationException
inSingleLocationRequest.getBestLocation
- [Android] Fix
IllegalStateException
calling addGeofences when number of geofences exceeds platform maximum (100).
- [Android]
getGeofence
/getGeofences
not returning newGeofence.vertices
property.
- [iOS] Fix "Duplicate symbol error DummyPods_TSLocationManager".
- [Android] Fix timeout issue in
.watchPosition
.
- 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.xml
fromAndroidManifest.xml
— it's causing conflicts with other plugins. - [Android] Add proguard-rule for compilation of the android library to prevent from obfuscating the
BuildConfig
class toa.a.class
, conflicting with other libraries.
- [Android] Performance enhancements and error-checking.
- [Typescript] Add missing
LocationError
value3
;
- [Android] Fix memory-leak in
.startBackgroundTask
: If aTask
timed-out and is "FORCE KILLED", it was never removed from aList<Task>
. - [Android] Fix
Exception NullPointerException:at com.transistorsoft.locationmanager.util.BackgroundTaskWorker.onStopped
- [Android]
⚠️ If you have the following elements defined in yourAndroidManifest.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" />
- [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] 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
WorkManager
instead of a foreground-service. - [Android] Android 14 (API 34) support: Due to new runtime permission requirements on
AlarmManager
exact 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:foregroundServiceType
in 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
. - [Android] Add sanity-check for invalid
Geofence
arguments (eg: invalid latitude/longitude). - [Android] Add safety-checks in ForegroundService stop-handling. There was a report of a reproducible crash while aggressively calling
.getCurrentPosition
in aTimer
(eg: every second). - [Android] Demote
HeartbeatService
from a Foreground Service toAlarmManager
ONESHOT.⚠️ In youronHeartbeat
event, if you intend to perform any kind of asynchronous function, you should wrap it insideBackgroundGeolocation.startBackgroundTask
in order to prevents the OS from suspending your app before your task is complete:
BacckgroundGeolocation.onHeartbeat(async (event) => {
console.log("[onHeartbeat] $event");
// First register a background-task.
const taskId = await BackgroundGeolocation.startBackgroundTask();
try {
// Now you're free to perform long-running tasks, such as getCurrentPosition()
const location = await BackgroundGeolocation.getCurrentPosition({
samples: 3,
timeout: 30,
extras: {
"event": "heartbeat"
}
});
console.log("[onHeartbeat] location:", $location);
} catch(error) {
console.log("[getCurrentPosition] ERROR:", error);
}
// Be sure to singal completion of your background-task:
BackgroundGeolocation.stopBackgroundTask(taskId);
});
- [Android] Fix NPE iterating a
List
inAbstractService
. - [Android] If a
SingleLocationRequest
error occurs and at least one sample exits, prefer to resolve the request successfully rather than firing the error (eg:getCurrentPosition
,motionchange
,providerchange
requests).
- [Android][Expo] Adjust Expo plugin with Support for monorepos where the module may not exist in the expected node_modules path.
- [Android] Introduce gradle config ext vars for
logbackAndroidVersion
andslf4jVersion
.
- [Android] Gradle v8 now requires
namespace
attribute in gradle files. - [iOS] iOS 16.4 made a major change to location-services, exposed only when
Config.showsBackgroundLocationIndicator
isfalse
(the default). As a result of this change,Config.showsBackgroundLocationIndicator
will now default totrue
.
- Add Huawei HMS License support for the Expo plugin.
- [Android] Upgrade
logback-android
dependency to3.0.0
(org.slf4j-api
to `2.0.7).
-
[Android] Fix String concatenation issue on Turkish devices where method-name composed for use with reflection is in correctly capitalized (ie:
isMoving -> setIsMoving
is incorrectly capitalized with Turkish capital assetİsMoving
. Simply enforceLocale.ENGLISH
when 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.
- [Android] Bump default
hmsLocationVersion = 6.9.0.300
. There are reports of Google rejecting apps due to older huawei HMS dependencies. - [Android] Fix
ClassCastException
related to Motion API error
- [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)
.
.
.
- [Android] Fix expo plugin failing on Expo SDK >= 48. Regular expressions failed because Expo changed lines in the build.gradle files that the Expo plugin was using for anchors for where to inject new src. Changed to use more fundamental anchor elements for regular expressions that must exist.
- [Fixed][Android] Implement support for
play-services-location v21
(ext.playServicesLocationVersion
in yourandroid/build.gradle
). The plugin can now work with either<= v20
or>= v21
.
- [Fixed] Fixed inconsistency in API docs with
location.activity
(location.activity.type
) andMotionChangeEvent
provided toonActivityChange
(motionActivityEvent.activity
). - [Changed] Android Update
logback-android
version.
- [Fixed] Android: Catch
Fatal Exception: java.lang.IllegalArgumentException: NetworkCallback was already unregistered
- [Fixed] Android It has been discovered that the Android logger
logback-android
has not been automatically clearing all expired records (Config.logMaxDays
) from the log database. Thelogback-android
database consists of three tables and only one was being cleared (see tony19/logback-android#214), resulting in a constantly growing database (wherelogLevel > LOG_LEVEL_OFF
). This version of the plugin will alter thelogback-android
database tables withON DELETE CASCADE
to ensure all log-data is properly removed. - [Added] Added two new HTTP RPC commands
stopSchedule
andstartSchedule
(See API docs HTTP Guide for more information).
- [Android] Fix logic error with
getCurrentPosition
not respectingtimeout
.
- [Android]
play-services:location
has introduced a breaking change inv21
, breaking the plugin.googlePlayServicesLocationVersion
will be capped with a maximum ofv20
. The next major release (4.10.0
) will set a minimum required version ofv21
. - [Expo] The plugin now implements an Expo plugin for automated Setup.
- [iOS] Fix bug in iOS scheduler firing on days where it should not.
- [iOS] Rebuild
TSLocationManager.xcframework
with XCode 13 (instead of XCode 14). - [Android] Add new Config
Notification.channelId
for custom customizing theNotificationChannel
id. Some use rs have an existing foreground-service andNotificationChannel
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_NOTIFICATIONS
for Android 13 (targetSdkVersion 33). Requ ired to allow enabling notifications in Settings->Apps. - [Android] Add new Config option
Authorization.refreshHeaders
for full control over HTTP headers sent toAuthor ization.refreshUrl
when refreshing auth token. - [Android] Add
null
check when executingPowerManager.isPowerSaveMode()
- [Android] Add new
Config.disableProviderChangeRecord (default false)
to allow disabling the automatical HTTP POST of theonProviderChange
location 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: true
and calling.start()
followed immediately by.changePace(true)
. The SDK would fail to enter the moving state, entering the stationary state instead. - [iOS] Add new iOS 15
CLLocation
attributeLocation.ellipsoidal_altitude
The altitude as a height above the World Geodetic System 1984 (WGS84) ellipsoid, measured in meters. AndroidLocation.altitude
has always returned ellipsoidal altutude, so bothLocation.altitude
andLocation.ellipsoidal_altitude
will return the same value.
- [Android] Fix
java.lang.IllegalArgumentException
TSProviderManager.handleProviderChangeEvent`. - [Android]
startOnBoot: false
withstopOnTerminate: false
could start-on-boot. - [Android]
State.enabled
returned by calling.stop()
returnstrue
due to implementation running in a background-thread butcallback
executed immediately on the main-thread. However, requesting.getState()
immediately after calling.stop
would return the correct value ofState.enabled
- [Android] Fix
notification.sticky
not being respected.
- Fix issue for react-native 0.69: They made a breaking change with the old, unused react-native.config.js, causing builds to fail. Simply delete the file
react-native.config.js
.
- [Android] Fix bug in
onProviderChange
event: not properly detecting when location-services disabled. - [Android] Android 12: Guard
Context.startForegroundService
withtry / catch
: the plugin will now catch exceptionForegroundServiceStartNotAllowedException
and automatically retry with anAlarmManager
oneShot 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_TASKS
traditionally 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
WhenInUse
behaviour: 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
useSignificantChangesOnly
behaviour. Will use a defaultmotionTriggerDelay
with minimum 60000ms, minimumdistanceFilter: 250
and enforcedstopTimeout: 20
. - [iOS] iOS 15 has finally implemented Mock Location Detection.
location.mock
will now be present for iOS when the location is mocked, just like Android. - [Android] Re-factor onProviderChange. Add broadcast-receiver for
AIRPLANE_MODE
detection. - [Android] Add guard against Android 12 issue where location-services fail to turn off after terminate and plugin enters stationary state.
- [Android] Prevent recording motionchange position from running after onProviderChange.
- [Android] Fix bug in Android 12 support for executing
.start()
in background while terminated. UsedJobScheduler
ONESHOT instead ofAlarmManager
. - [Android] Plugin could be placed into an infinite loop requesting motionchange position in some cases.
- [Android] Address
ConcurrentModificationException
inonPermissionGranted
.
- [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'sTrackingService
as soon as.start()
executes. If a location-timeout occurs while fetching the onMotionChange position after device reboot withstartOnBoot: true
, theForegroundServiceStartNotAllowedException
could be raised. - [Android] Add two new attributes
android:enabled
andandroid:permission
to 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">
- [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
- [Android] Added two new
androidx.lifecycle
dependencies to plugin'sbuild.gradle
, in addition to correspondingext
varsext.lifeCycleRunTimeVersion
andext.lifeCycleRuntimeVersion
"androidx.lifecycle:lifecycle-runtime"
"androidx.lifecycle:lifecycle-extensions"
- [Android] Add a few extra manufacturer-specific
Intent
forDeviceSettings.showPowerManager()
. - [Android] Minimum
compileSdkVersion 31
is now required. - [Android] Now that a minimum
targetSdkVersion 29
is required to release an Android app to Play Store, the SDK'sAndroidManifest
now automatically appliesandroid:foregroundServiceType="location"
to all requiredService
declarations. 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>
- [Android] Upgrade
android-permissions
dependency from 0.1.8 -> 2.1.6. - [iOS] Rebuild
TSLocationManager.xcframework
with XCode 13.3
- [Android] While testing adding 20k geofences, the Logger can cause an
OutOfMemory
error. 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
- [Fixed][iOS] Regression bug in iOS SAS authorization strategy
- [Fixed][Android] Android logger defaulting to LOG_LEVEL_VERBOSE when initially launched configured for LOG_LEVEL_OFF
- [Changed][iOS] Rebuild with latest XCode
13.2.1
- [Fixed][iOS] More issues with iOS plugin 'invalidate' method. Get rid of this method. Implement startObserving, stopObserving.
- [Fixed][iOS] Backwards compatibility issue: [email protected] does have this method.
No visible @interface for 'RCTEventEmitter' declares the selector 'invalidate' in RNBackgroundGeolocation.m
.
- [Fixed][Android] Android 12 behaviour changes mean that foreground-services remain running. When an Android app is terminated, the app process does not terminate (since the foreground-service is active) and
RNBackgroundGeolocationModule
remains in memory. Given that, the plugin cannot rely on registering its event-listeners in theRNBackgroundGeolocationModule
constructor, but must perform that task when.ready()
is called. This also requires resettingmReady = false
when theMainActivity
is destroyed, so that the next time.ready()
is called, the event-listeners are re-registered. - [Fixed][Android] When
.ready()
is calledreset: false
, thesuccess
callback was not invoked with the currentState
. This bug was introduced in previousv4.4.1
.
- [Added] Added a
Subscription
interface to Typescript API. Added helpful docs to Subscription for new event-handler subscriptions.
import BackgroundGeolocation, {
Subscription
} from "...";
.
.
.
const subscription:Subscription = BacckgroundGeolocation.onLocation(myHandler);
- [Added] New
Authorization.strategy "SAS"
(alternative to defaultJWT
). - [Fixed] Fixed
RCTEventEmitter
warning "addListener", "removeListeners". A corresponding fix has also been released for react-native-background-fetch so be sure to update tobackground-fetch >= 4.0.4
. - [Changed] Deprecated
BackgroundGeolocation.removeListener
. All event-handlers now return areact-native
Subscription
instance containing a.remove()
method. You will keep track of your ownsubscription
instances and call.remove()
upon them when you wish to remove an event listener. Eg:
/// OLD
const onLocation = (location) => {
console.log('[onLocation');
}
BackgroundGeolocation.onLocation(onLocation);
...
// deprecated: removeListener
BackgroundGeolocation.removeListener('location', onLocation);
/// NEW: capture returned subscription instance.
const onLocationSubscription = BackgroundGeolocation.onLocation(onLocation);
...
// Removing an event-listener.
onLocationSubscription.remove();
- [Added][Android] Implement new Android 12 "reduced accuracy" mechanism
requestTemporaryFullAccuracy
. - [Fixed][iOS]
Authorization.refreshPayload refreshToken
was not performing a String replace on the{refreshToken}
template, instead over-writing the entire string. Eg: if provided with'refresh_token': 'Bearer {refreshToken}
,Bearer
would be over-written and replaced with only the refresh-token. - [Fixed][Android] Fixed crash reported by Huawei device, where verticalAccuracy returns NaN.
- [Fixed][iOS] add config change listeners for
heartbeatInterval
andpreventSuspend
to dynamically update interval when changed withsetConfig
. - [Fixed][Android] Add
accuracyAuthorization
param to event data provided toonProviderChange
event. - [Changed][Android] Update Android default
okhttp
version to3.12.13
. - [Changed][Android] Update Android
eventbus
version to3.2.0
. - [Changed][Android] Update Android
android-permissions
to import from MavenCentral instead of deprecatedjCenter
. - [Fixed][Android] Fix an edge-case requesting motion permission. If
getCurrentPosition()
is executed before.start()
, the Android SDK fails to request motion permission.
- [Changed] Build iOS TSLocationManager.xcframework with XCode 12.4 instead of 12.5
- [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.
- [Changed]
Config.authorization
will perform regexp on the received response, searching for keys such asaccessToken
,access_token
,refreshToken
,refresh_token
. - [Fixed] Typescript definition for interface
HeadlessEvent
was missingtimeout: boolean
attribute. Thanks @mikehardy. - [Added] Add typescript constants for plugin events, eg:
BackgroundGeolocation.EVENT_MOTIONCHANGE
.
- [Fixed][iOS]
"OBJC_IVAR$_DDLogMessage._tag"
. CocoaLumberjack pushed a breaking change to 3.7.1 on 04/08. Pins [email protected]
- [Changed] Re-generate docs with latest typedoc. The docs search feature now actually works.
- [Changed][iOS] Update
pod CocoaLumberjack
to latest~> 3.7.0
.
- [Changed][iOS] Simply apply a cocoapods version constraint of
1.10.0
in podspec.
- [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
⚠️ Requires [email protected]
.
$ yarn add [email protected]
- [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.altitude_accuracy
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({
locationAuthorizationRequest: 'Always',
backgroundPermissionRationale: {
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.
- [Added] Huawei-specific implementation for method isPowerSaveMode. Was always returning true.
- [Changed] Remove unnecessary android.exported on several AndroidManifest elements.
- [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
:
BackgroundGeolocation.onProviderChange((event) => {
print("[providerchange]", event);
// Did the user disable precise locadtion in iOS 14+?
if (event.accuracyAuthorization == BackgroundGeolocation.ACCURACY_AUTHORIZATION_REDUCED) {
// Supply "Purpose" key from Info.plist as 1st argument.
BackgroundGeolocation.requestTemporaryFullAccuracy("DemoPurpose").then((accuracyAuthorization) => {
if (accuracyAuthorization == BackgroundGeolocation.ACCURACY_AUTHORIZATION_FULL) {
console.log("[requestTemporaryFullAccuracy] GRANTED:", accuracyAuthorization);
} else {
console.log("[requestTemporaryFullAccuracy] DENIED:", accuracyAuthorization);
}
}).catch((error) => {
console.log("[requestTemporaryFullAccuracy] FAILED TO SHOW DIALOG:", error);
});
}
}
These changes are fully compatible with Android, which will always return BackgroundGeolocation.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
. - [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: - [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]
).
Example
componentDidMount() {
BackgroundGeolocation.ready({
locationAuthorizationRequest: 'WhenInUse',
.
.
.
});
}
async onClickStartTracking() {
await BackgroundGeolocation.start();
//
// some time later -- could be immediately after, hours later, days later, etc.
//
// Simply update `locationAuthorizationRequest` to "Always" -- the SDK will cause iOS to automatically show the authorization upgrade dialog.
BackgroundGeolocation.setConfig({
locationAuthorizationRequest: 'Always'
});
}
- [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. [Fixed][Android] ModifyisMainActivityActive
code to look specifically forMainActivity
instead of any activity. Some apps might use their own custom activity during headless operation.
- [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
:
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
+ maven {
+ // Required for react-native-background-geolocation
+ url("${project(':react-native-background-geolocation-android').projectDir}/libs")
+ }
+ maven {
+ // Required for react-native-background-fetch
+ url("${project(':react-native-background-fetch').projectDir}/libs")
+ }
+ }
}
- [Fixed][Android]
onConnectivityChange
can report incorrect value forenabled
when toggling between Wifi Off / Airplane mode. - [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 AndroidMainApplication.java
. 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 {
.
.
.
// [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 YES;
}
Android MainApplication.java
public class MainApplication extends Application implements ReactApplication {
@Override
public void onCreate() {
super.onCreate();
.
.
.
// [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.
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][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][Android] Android plugin was importing an
androidx
dependencylocalbroadcastmanager
without first checking ifuseAndroidX
was set totrue
. - [Fixed][iOS] When using
disableStopDetection: true
withpausesLocationUpdatesAutomatically: true
, theCLLocationManagerDelegate didPauseLocationUpdates
themotionchange
event reportedisMoving: true
. - [Fixed][Android] Ensure location failure callback is executed on main-thread.
- [Changed][Android] Gradle import
tslocationmanager.aar
usingapi
rather thanimplementation
in order to allow overrides inAndroidManifest.xml
. - [Fixed][iOS] When upgrading from a version previous to
3.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
. - [Fixed] Allow firebase-adapter to validate license flavors on same key (eg: .development, .staging).
- [Fixed] 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 JavascriptonGeofence
to be fired). - [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
.
- [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] iOS
Config.showsBackgroundLocationIndicator
, A Boolean indicating whether the status bar changes its appearance when an app uses location services in the background. - [Changed]
cordova-plugin-background-fetch
dependency updated to3.x
with new iOS 13BGTaskScheduler
API. - [Fixed]
synchronize
methods inTSLocationManager
to address Android NPE related tobuildTSLocation
. - [Fixed] Typescript declaration for
Location.isMoving
should beLocation.is_moving
. - [Fixed] iOS: Bug in
accessToken
RegExp in Authorization token-refresh handler. - [Fixed] Part of the raw Javascript API contained typescript, which would cause an error on older mobile browser versions.
- [Added] Implement four new RPC commands
addGeofence
,removeGeofence
,addGeofences
,removeGeofences
. Document available RPC commands in "HttpGuide". - [Fixed] Android: launch-Intent for foreground-service notification was causing notification-click to re-launch the Activity rather than show existing.
- [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] 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
.
- [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 usingBackgroundGeolocation.transistorTrackerParams
is now deprecated. - [Added] New
DeviceInfo
module for providing simple device-info (model
,manufacturer
,version
,platform
).
- [Fixed] Android bug in params order to getLog. Thanks @mikehardy.
- [Fixed] Typo in Javascript API callback in
destroyLog
. Thanks @mikehardy.
- [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 available atBackgroundGeolocation.logger
. See docs for more information. Existing log methods onBackgroundGeolocation
are now@deprecated
. - [Changed] All logging methods (
getLog
,emailLog
anduploadLog
) now accept an optionalSQLQuery
. Eg:
let query = {
start: Date.parse('2019-10-23 09:00'),
end: Date.parse('2019-10-23 19:00'),
limit: 1000,
order: Logger.ORDER_ASC
};
let Logger = BackgroundGeolocation.logger;
let log = await Logger.getLog(query)
Logger.emailLog('[email protected]', 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. Fixes #1992. - [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.
- [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. - [Changed] Android now hosts its own
proguard-rules.pro
. See Android setup docs for new integration of plugin's required Proguard Rules into your app. 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.
- [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)
- [Changed] Minor changes to
build.gradle
: fetchminSdkVersion
fromext
instead of hard-coding, useimplementation
withreact
instead ofcompileOnly
.
- [Added] iOS 13 support.
- [Added] Auto-linking support. Do not use
react-native link
anymore. See the Setup docs for Android and iOS. Before installing3.2.0
, firstreact-native unlink
bothbackground-geolocation
andbackground-fetch
.
react-native-background-geolocation < 3.2.0
installed into react-native >= 0.60
, you should first unlink
your previous version as react-native link
is no longer required.
$ react-native unlink react-native-background-geolocation
- [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 iOS-like location permission model which now requestsWhen In Use
orAlways
. 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()
. - [Added] Add new Android gradle config parameter
appCompatVersion
to replacesupportLibVersion
for better AndroidX compatibility. IfappCompatVersion
is not found, the plugin's gradle file falls back tosupportLibVersion
. For [email protected], you should start using the newappCompatVersion
.
[Changed] Implement react-native.config.js
ahead of deprecated rnpm
config.
- [Fixed] Added logic to detect when app is configured to use AndroidX dependencies, adjusting the required
appcompat
dependency accordingly. If the gradle configext.supportLibVersion
corresponds to an AndroidX version (eg:1.0.0
), the plugin assumes AndroidX. - [Changed] Remove
cocoa-lumberjack
as a dependency sincereact-native >= 0.60.0
iOS apps are all Cocoapods now. There's no longer a need for this dependency now since the plugin's podspec can importCocoaLumberjack
pod directly. This is going to cause short-term pain for those using< 0.60.0
, forcing one to manually installcocao-lumberjack
. - [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] iOS & Android: 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
to preventnull
Intent being delivered toHeartbeatService
, causing a crash. - [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 of3.x
.
- [Changed] Bump
CocoaLumberjack
dependency to~> 3.5.1
. - [Fixed] Android
destroyLocations
callback was being executed in background-thread. - [Fixed] When Android geofence API receives a
GEOFENCE_NOT_AVAILABLE
error (can occur if Wifi is disabled), geofences must be re-registered. - [Fixed] Android
Config.disableStopDetection
was not implemented. - [Added] Add new Android Config options
scheduleUseAlarmManager
for forcing scheduler to useAlarmManager
insead ofJobService
for more precise scheduling.
- [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.
- [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 starts/stops after rebooting the device with plugin in moving state.
- [Fixed] Android headless
heartbeat
events were failing (incorrectContext
was supplied to the event).
- [Fixed] Windows bug in new
react-native link
script. - [Fixed] Android scheduler bug. When app is terminated & restarted during a scheduled ON period, tracking-service does not restart.
- [Added] Added android implementation for
react-native link
script to automatically add the requiredmaven url
andext.googlePlayServicesLocationVersion
.
- [Changed] Promote
3.0.0-rc.5
to3.0.0
.
- [Fixed] Android: Another
NullPointerException
withBundle#getExtras
.
- [Fixed] Android
NullPointerException
withBundle#getExtras
. - [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] Remove unused Gradle function.
[Changed] The license format has changed. New 3.0.0
licenses are now available for customers in the product dashboard.
- For versions
< 3.0.0
, use old license keys. - For versions
>= 3.0.0
, use new license keys.
- For those minifying their generated Android APK by enabling the following in your
app/build.gradle
,
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = true
You must add the following line to your proguard-rules.pro
:
-keepnames class com.facebook.react.ReactActivity
See the full required Proguard config in the Android Setup Doc.
- [Fixed] Logic bugs in MotionActivity triggering between stationary / moving states.
- [Fixed] Remove iOS react-native
#include
cruftif __has_include(“XXX.h”)
for support RN libs during their transition to using Frameworks. Fixes #669. - [Fixed] iOS crash with configured
schedule
:index 2 beyond bounds [0 .. 1]' was thrown
. Fixes #666. - [Fixed]
NullPointerException in logger
. References #661.
- [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:
-
[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({
geofenceModeHighAccuracy: true,
desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_MEDIUM,
locationUpdateInterval: 5000,
distanceFilter: 50
));
BackgroundGeolocation.startGeofences();
- Transition events are delayed in favour of lower power consumption.
- Transition events are nearly instantaneous at the cost of higher power consumption.
- [Added] Android implementation of
startBackgroundTask
/stopBackgroundTask
.
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.
getDataFromServer('https://foo.bar.com').then((result) => {
// Be sure to always signal completion of your taskId.
BackgroundGeolocation.stopBackgroundTask(taskId);
}).catch((error) => {
// Be sure to always signal completion of your taskId.
BackgroundGeolocation.stopBackgroundTask(taskId);
});
Logging for Android 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. See the Config.debug for a new decription of iOS / Android sound FX including a media player to play each.
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 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 BackgroundGeolocation plugin
purgeBackgroundGeolocationDebugResources(applicationVariants)
compileSdkVersion rootProject.ext.compileSdkVersion
.
.
.
}
- [Changed] Removed Android config option
activityRecognitionInterval
andminimumActivityRecognitionConfidence
. The addition of the new "stationary geofence" for Android should alleviate issues with poor devices failing to initiate tracking. 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
.
- [Fixed] Logic bugs in MotionActivity triggering between stationary / moving states.
- [Added] Android-only Config option
geofenceModeHighAccuracy
for more control over geofence triggering accuracy. Runs a foreground-service during geofences-only mode (#startGeofences
). - [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. - [Changed] Update
android-permissions
dependency to0.1.8
.
- [Fixed] Android bug in Config dirty-fields mechanism.
- [Changed] Improve trackingMode state-changes between location -> geofences-only.
- [Changed] Improvements to geofences-only tracking.
- [Changed] Improvements to stationary-geofence monitoring, detecting mock locations to prevent stopTimeout triggering.
- [Changed] Tweaking stationary region monitoring.
- [Changed] Tweaking bad vendor detection to force stopTimeout timer when device is stationary for long periods and motion api hasn't respon ded.
-
[Changed] Major refactor of Android Service architecture. The SDK no longer requires a foreground-service active at all times. The foreground-service (and cooresponding persistent notification) will only be active while the SDK is in the moving state. No breaking dart api changes.
-
[Changed] Improved Android debug notifications.
-
[Added] Added new Config options
persistMode
for specifying exactly which events get persisted: location | geofence | all | none. -
[Added] Experimental Android-only Config option
speedJumpFilter (default 300 meters/second)
for detecting location anomalies. The plugin will measure the distance and apparent speed of the current location relative to last location. If the apparent speed is >speedJumpFilter
, the location will be ignored. Some users, particularly in Australia, curiously, have had locations suddenly jump hundreds of kilometers away, into the ocean. -
[Changed] iOS and Android will not perform odometer updates when the calculated distance is less than the average accuracy of the current and previous location. This is to prevent small odometer changes when the device is lingering around the same position.
-
[Fixed] Added Android gradle dependency
appcompat-v7
-
[Fixed] Minor change to Android
HeadlessTask
to fix possible issue withLooper
. -
[Added] New
DeviceSettings
API for redirecting user to Android Settings screens, including vendor-specific screens (eg: Huawei, OnePlus, Xiaomi, etc). This is an attempt to help direct the user to appropriate device-settings screens for poor Android vendors as detailed in the site Don't kill my app. -
[Added]
schedule
can now be configured to optionally execute geofences-only mode (ie:#startGeofences
) per schedule entry. Seeschedule
docs. -
[Changed] Update Gradle config to use
implementation
instead of deprecatedcompile
-
[BREAKING] Change Gradle
ext
configuration propertygooglePlayServicesVersion
->googlePlayServicesLocationVersion
. Now that Google has decoupled all their libraries,play-services:location
now has its own version, independant of all other libs.
android/build.gradle
:
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
- googlePlayServicesVersion = "16.0.0"
+ googlePlayServicesLocationVersion = "16.0.0"
}
}
-
[Changed] Android Service: Return
START_STICKY
instead ofSTART_REDELIVER_INTENT
. -
[Changed] Android:
setShowBadge(false)
on AndroidNotificationChannel
. Some users reporting that Android shows a badge-count on app icon when service is started / stopped. -
[Fixed] Android
extras
provided towatchPosition
were not being appended to location data. -
[Fixed] Android NPE in
watchPosition
-
[Added] Added method
getProviderState
for querying current state of location-services. -
[Added] Added method
requestPermission
for manually requesting location-permission (#start
,#getCurrentPosition
,#watchPosition
etc, will already automatically request permission. -
[Changed] Upgrade Android logger dependency to latest version (
logback
). -
[Fixed] Prevent Android foreground-service from auto-starting when location permission is revoked via Settings screen.
-
[Fixed] NPE in Android HTTP Service when manual sync is called. Probably a threading issue with multiple sync operations executed simultaneously.
- [Added] Android SDK 28 requires new permission to use foreground-service.
- [Fixed] Do not calculate odometer with geofence events. Android geofence event's location timestamp does not correspond with the actual time the geofence fires since Android is performing some heuristics in the background to ensure the potential geofence event is not a false positive. The actual geofence event can fire some minutes in the future (ie: the location timestamp will be some minutues in the past). Using geofence location in odometer calculations will corrupt the odometer value.
- [Fixed] Android could not dynamically update the
locationTemplate
/geofenceTemplate
without#stop
and application restart. - [Fixed] Android
startGeofences
after revoking & re-granting permission would fail to launch the plugin's Service. - [Fixed] iOS HTTP crash when using
batchSync: true
. At application boot, there was a threading issue if the server returned an HTTP error, multiple instances of the HTTP service could run, causing a crash.
- [Fixed] react-native link on Windows.
- [Fixed] Android
NullPointerException
onWatchPositionCallback
withwatchPosition
.
- [Fixed] Mistake in module-name in index.d.ts
- [Fixed] Documentation issue with method signature
getCurrentPosition
. - [iOS] Catch
NSInvalidArgumentException
when decodingTSConfig
. - [Fixed]
react-native link
scripts were accidentally.npmignore
d causing errorUnhandled 'error' event
when linking.
- [Added] Implement Typescript API
- [Added] Refactor documentation. Now auto-generated from Typescript api with Typedoc and served from https://transistorsoft.github.io/react-native-background-geolocation
- [Breaking] Change event-signature of
location
event: location-errors are now received in newfailure
callback rather than separateerror
event. Theerror
event has been removed.
BackgroundGeolocation.onLocation((location) => {
console.log('[location] -', location);
}, (errorCode) => {
// Location errors received here.
console.log('[location] ERROR -', errorCode);
});
- [Added] With the new Typescript API, it's necessary to add dedicated listener-methods for each method (in order for code-assist to work).
// Old: No code-assist for event-signature with new Typescript API
BackgroundGeolocation.on('location', (location) => {}, (error) => {});
// New: use dedicated listener-method #onLocation
BackgroundGeolocation.onLocation((location) => {}, (error) => {});
// And every other event:
BackgroundGeolocation.onMotionChange(callback);
BackgroundGeolocation.onMotionProviderChange(callback);
BackgroundGeolocation.onActivityChange(callback);
BackgroundGeolocation.onHttp(callback);
BackgroundGeolocation.onGeofence(callback);
BackgroundGeolocation.onGeofencesChange(callback);
BackgroundGeolocation.onSchedule(callback);
BackgroundGeolocation.onConnectivityChange(callback);
BackgroundGeolocation.onPowerSaveChange(callback);
BackgroundGeolocation.onEnabledChange(callback);
- [Breaking] Change event-signature of
enabledchange
event to return simpleboolean
instead of{enabled: true}
: It was pointless to return an{}
for this event.
// Old
BackgroundGeolocation.onEnabledChange((enabledChangeEvent) => {
console.log('[enabledchange] -' enabledChangeEvent.enabled);
})
// New
BackgroundGeolocation.onEnabledChange((enabled) => {
console.log('[enabledchange] -' enabled);
})
- [Breaking] Change signature of
#getCurrentPosition
method: Options{}
is now first argument rather than last:
// Old (Options as 3rd argument)
BackgroundGeolocation.getCurrentPosition((location) => {
console.log('[getCurrentPosition] -', location);
}, (error) => {
console.log('[getCurrentPosition] ERROR -', error);
}, { // <-- Options as 3rd argument
samples: 3,
extras: {foo: 'bar'}
})
// New (Options as 1st argument)
BackgroundGeolocation.getCurrentPosition({
samples: 3,
extras: {foo: 'bar'}
}, (location) => {
console.log('[getCurrentPosition] -', location);
}, (error) => {
console.log('[getCurrentPosition] ERROR -', error);
})
- [Fixed] iOS was missing Firebase adapter hook for persisting geofences.
- [Changed] Android headless events are now posted with using
EventBus
instead ofJobScheduler
. Events posted via AndroidJobScheduler
are subject to time-slicing by the OS so events could arrive late. - [Fixed] Missing
removeListeners
forconnectivitychange
,enabledchange
events. - [Fixed] iOS was not calling
success
callback forremoveListeners
. - [Fixed] iOS plugin was not parsing schedule in
#ready
event.
- [Fixed] iOS was missing Firebase adapter hook for persisting geofences.
- [Changed] Android headless events are now posted with using
EventBus
instead ofJobScheduler
. Events posted via AndroidJobScheduler
are subject to time-slicing by the OS so events could arrive late. - [Fixed] Missing
removeListeners
forconnectivitychange
,enabledchange
events. - [Fixed] iOS was not calling
success
callback forremoveListeners
. - [Fixed] iOS plugin was not parsing schedule in
#ready
event.
- [Fixed] Minor error in plugin's
build.gradle
.DEFAULT_BUILD_TOOLS_VERSION
was set incorrectly.
- [Fixed] iOS scheduler not being initialized in
#ready
after reboot.
- [Fixed] Android firebase plugin bug in release build.
- [Added] New Android config-option
notificationChannelName
for configuring the notification-channel required by the foreground-service notification. See Settings->Apps & Notificaitions->Your App->App Notifications. - [Added] Support for new Firebase Adapter
- [Added] iOS support for HTTP method
PATCH
(Android already supports it). - [Fixed] Android was not using
httpTimeout
with latestokhttp3
. - [Fixed] Android issue not firing
providerchange
on boot when configured withstopOnTerminate: true
- [Fixed] Android
headlessJobService
class could fail to be applied when upgrading from previous version. Ensure always applied. - [Fixed] Android
httpTimeout
was not being applied to newokhttp3.Client#connectionTimeout
- [Fixed] Apply recommended XCode build settings.
- [Fixed] XCode warnings 'implicity retain self in block'
- [Changed] Android Removed unnecessary attribute
android:supportsRtl="true"
fromAndroidManifest
- [Fixed] iOS
preventSuspend
was not working withuseSignificantChangesOnly
- [Changed] iOS disable encryption on SQLite database file when "Data Protection" capability is enabled with
NSFileProtectionNone
so that plugin can continue to insert records while device is locked.
- [Fixed] Fix
react-native link
error when iOS and npm project name are diferent. - [Fixed] iOS issue when plugin is booted in background in geofences-only mode, could engage location-tracking mode.
- [Fixed] Android
getCurrentPosition
was not respectingpersist: true
when executed in geofences-only mode.
- [Fixed] iOS geofence exit was being ignored in a specific case where (1) geofence was configured with
notifyOnDwell: true
AND (2) the app was booted in the background due to a geofence exit event.
- [Fixed] Android bug where plugin could fail to translate iOS desiredAccuracy value to Android value, resulting in incorrect
desiredAccuracy
value for Android, probably defaulting toDESIRED_ACCURACY_LOWEST
.
- [Added] iOS config
disableLocationAuthorizationAlert
for disabling automatic location-authorization alert when location-services are disabled or user changes toggles location access (eg:Always
->WhenInUse
). - [Fixed] Android was not executing
#getCurrentPosition
failure
callback. - [Fixed] Fixed issue executing
#getCurrentPosition
from Headless mode while plugin is current disabled. - [Added] Add new iOS
locationAuthorizationRequest: "Any"
for allowing the plugin to operate in eitherAlways
orWhenInUse
without being spammed by location-authorization dialog.
- [Fixed] Android
getCurrentPosition
would not work from a HeadlessTask when the plugin was not currentlyenabled
.
- [Changed] Repackage android lib
tslocationmanager.aar
as a Maven Repositoroy.⚠️ Installation procedure has changed slightly. Please review Android installation docs for your chosen install method (Manual or react-native link). - [Added] Added new initialization method
#ready
, desigend to replace#configure
(which is now deprectated). The new#ready
method operates in the same manner as#configure
with a crucial difference -- the plugin will only apply the supplied configuration{}
at the first launch of your app — thereafter, it will automatically load the last-known config from persistent storage. - [Added] Add new method
#reset
for resetting the plugin configuration to documented defaults. - [Added] Refactor Javascript API to use Promises. Only
#watchPosition
and adding event-listeners with#on
will not use promises. - [Fixed] iOS issue not turning of "keepAlive" system when
#stop
method is executed while stop-detection system is engaged. - [Added] Android will fire
providerchange
event after the result of user location-authorization (accept/deny). The result will be available in thestatus
key of the event-object. - [Changed] Refactor native configuration system for both iOS and Android with more traditional Obj-c / Java API.
- [Changed] Create improved Obj-c / Java APIs for location-requests (
#getCurrentPosition
,#watchPosition
) and geofencing. - [Added] Added new event
connectivitychange
for detecting network connectivity state-changes. - [Added] Added new event
enabledchange
, fired with the plugin enabled state changes. Executing#start
/#stop
will cause this event to fire. This is primarily designed for use withstopAfterElapsedMinutes
.
- [Fixed] Guard usage of
powersavechange
event for iOS < 9 - [Added] Android permissions are now handled completely within
tslocationmanager
library rather than within Cordova Activity. - [Fixed] iOS
emailLog
issues: sanity check existence of email client, ensure we have reference to topMostUIViewController
. - [Added] New Android "Headless" mechanism allowing you provide a simple custom Java class to receive all events from the plugin when your app is terminated (with
stopOnTerminate: false
). The headless mechanism is enabled with new@config {Boolean} enableHeadless
. See the Wiki "Headless Mode" for details. - [Fixed] iOS
getCurrentPosition
was applying entire options{}
asextras
. - [Fixed] iOS
watchPosition
/getCurrentPosition
@option persist
was being ignored when plugin was disabled (ie:#stop
ped). - [Fixed] Implement Android
JobScheduler
API for scheduler (where API_LEVEL) allows it. Will fallback to existingAlarmManager
implementation where API_LEVEL doesn't allowJobScheduler
. This fixes issues scheduler issues with strict new Android 8 background-operation rules. - [Added] Added new Android
@config {Boolean} allowIdenticalLocations [false]
for overriding the default behaviour of ignoring locations which are identical to the last location. - [Added] Add iOS
CLFloor
attribute tolocation.coordinate
for use in indoor-tracking when required RF hardware is present in the environment (specifies which floor the device is on).
- [Fixed] Rare issue with iOS where rapidly toggling executing
start
withchangePace(true)
in the callback followed bystop
, over and over again, would lock up the main thread. - [Changed] Android
GEOFENCE_INITIAL_TRIGGER_DWELL
defaulted totrue
. - [Fixed]
Proguard-Rules
were not ignoring the newLogFileProvider
used for#emailLog
method. - [Fixed] Android issue on some device where callback to
#configure
would not be executed in certain cases.
- [Fixed] Android NPE on
Settings.getForegroundService()
when usingforegroundService: false
- [Fixed] Android 8 error with
emailLog
. Crash due toSecurityException
when writing the log-file. Fixed by implementingFileProvider
(storage permissions no longer necessary). - [Fixed] iOS bug when providing non-string
#header
values. Ensure casted to String. - [Changed] Android minimum required play-services version is
11.2.0
(required for newplay-services
APis. Anything less and plugin will crash. - [Changed] Update Android to use new
FusedLocationProviderClient
instead of now-deprectatedFusedLocationProviderAPI
. It's the same underlying play-services location API -- just with a much simpler, less error-prone interface to implement. - [Fixed] On Android, when
changePace(true)
is executed while device is currentlystill
(and remainsstill
),stopTimeout
timer would never initiate until device movement is detected. - [Fixed] iOS manual
#sync
was not executing any callback if database was empty. - [Added] Implement new Android 8
NotificationChannel
which is now required for displaying theforegroundService
notification. - [Added] Android foreground-service notification now uses
id: 9942585
. If you wish to interact with the foreground-service notification in native code, this is theid
. - [Fixed] iOS not always firing location
failure
callback. - [Fixed] iOS was not forcing an HTTP flush on
motionchange
event whenautoSyncThreshold
was used. - [Fixed] iOS Add sanity-check for Settings
boolean
type. It was possible to corrupt the Settings when aboolean
-type setting was provided with a non-boolean value (eg:{}
,[]
). - [Fixed] Android
getState
could cause an NPE if executed before#configure
. - [Fixed] Work around iOS 11 bug with
CLLocationManager#stopMonitoringSignificantLocationChanges
(SLC): When this method is called upon any singleCLLocationManager
instance, it would cause all instances to#stopMonitoringSignificantLocationChanges
. This caused problems with Scheduler evaluation, since SLC is required to periodically evaluate the schedule.
- [Added] Re-build for iOS 11, XCode 9
- [Added] Implement new
powersavechange
event in addition toisPowerSaveMode
method for determining if OS "Power saving" mode is enabled. - [Added] New config
elasticityMultiplier
for controlling the scale ofdistanceFilter
elasticity calculation. - [Fixed] Android bug not firing
schedule
Javascript listeners - [Fixed] Android crash
onGooglePlayServicesConnectdError
when Google Play Services needs to be updated on device.
- [Changed] Refactor Android
onDestroy
mechanism attempting to solve nagging and un-reproducible null pointer exceptions. - [Added] Implement Android location permissions handling using
PermissionsAndroid
API. You no longer need to use 3rd-party permissions module to obtain Android location permission. - [Fixed] Fixed bug not where
stopAfterElapsedMinutes
is not evaluated when executing#getCurrentPosition
. - [Fixed] Modifications for Android O. For now,
foregroundService: true
will be enforced when running on Android O (api 26).
- [Changed] Reference latest
react-native-background-fetch
version2.1.0
- [Added] Javascript API to plugin's logging system.
- [Fixed] Minor issue with iOS flush where multiple threads might create multiple background-tasks, leaving some unfinished.
- [Changed] Refactor iOS / Android core library event-subscription API.
- [Added] Removing single event-listeners with
#removeListener
(alias#un
) is snow fully supported! There will no longer be warnings "No listeners for event X", since the plugin completely removes event-listeners from the core library. You will no longer have to createnoop
event-listeners on events you're not using simply to suppress these warnings.
- [Changed] Improve iOS/Android acquisition of
motionchange
location to ensure a recent location is fetched. - [Changed] Implement
#getSensors
method for both iOS & Android. Returns an object indicating the presense of accelerometer, gyroscope and magnetometer. If any of these sensors are missing, the motion-detection system for that device will poor. - [Changed] The
activitychange
success callback method signature has been changed from{String} activityName
->{Object}
containing bothactivityName
as well asconfidence
. This event only used to fire after theactivityName
changed (eg:on_foot
->in_vehicle
), regardless ofconfidence
. This event will now fire for any change in activity, includingconfidence
changes. - [Changed] iOS
emailLog
will gzip the attached log file. - [Added] Implement new Android config
notificationPriority
for controlling the behaviour of theforegroundService
notification and notification-bar icon. - [Changed] Tweak iOS Location Authorization to not show locationAuthorizationAlert if user initially denies location permission.
- [Fixed] Android: Remove isMoving condition from geofence proximity evaluator.
- [Fixed] Android was creating a foreground notification even when
foregroundService: false
- [Fixed] iOS 11 fix: Added new location-authorization string
NSLocationAlwaysAndWhenInUseUsageDescription
. iOS 11 now requires location-authorization popup to allow user to select eitherAlways
orWhenInUse
.
- [Fixed] Android & iOS will ensure old location samples are ignored with
getCurrentPosition
- [Fixed] Android
providerchange
event would continue to persist a providerchange location even when plugin was disabled for the case where location-services is disabled by user. - [Fixed] Don't mutate iOS
url
to lowercase. Just lowercase the comparison when checking for301
redirects. - [Changed] Android will attempt up to 5
motionchange
samples instead of 3. Cheaper devices can take longer to lock onto GPS. - [Changed] Android foregroundService notification priority set to
PRIORITY_MIN
so that notification doesn't always appear on top. - [Fixed] Android plugin was not nullifying the odometer reference location when
#stop
method is executed, resulting in erroneous odometer calculations if plugin was stopped, moved some distance then started again. - [Added] Android plugin will detect presense of Sensors
ACCELEROMETER
,GYROSCOPE
,MAGNETOMETER
andSIGNIFICANT_MOTION
. If any of these sensors are missing, the AndroidActivityRecognitionAPI
is considered non-optimal and plugin will add extra intelligence to assist determining when device is moving. - [Fixed] Bug in broadcast event
GEOFENCE
not being fired whenMainActivity
is terminated (only applies to those useHeadlessJS
). - [Added] Implement Javascript API for
removeAllListeners
for...you guessed it: removing all event-listeners. - [Fixed] Android scheduler issue when device is rebooted and plugin is currently within a scheduled ON period (fails to start)
- [Fixed] (Android) Fix error calling
stopWatchPosition
before#configure
callback has executed. Also add support for executing#getCurrentPosition
before#configure
callback has fired. - [Added] (Android) Listen to LocationResult while stopTimeout is engaged and perform manual motion-detection by checking if location distance from stoppedAtLocation is > stationaryRadius
- [Fixed] Bug in literal schedule parsing for both iOS and Android
- [Fixed] Bug in Android scheduler after app terminated. Configured schedules were not having their
onTime
andoffTime
zeroed, resulting in incorrect time comparison.
- [Fixed] Bug in Android scheduler after app terminated. Configured schedules were not having their
SECOND
andMILLISECOND
zeroed resulting in incorrect time comparison.
- [Added] New config
stopOnStationary
for both iOS and Android. Allows you to automatically#stop
tracking when thestopTimeout
timer elapses. - [Added] Support for configuring the "Large Icon" (
notificationLargeIcon
) on AndroidforegroundService
notification.notificationIcon
has now been aliased ->notificationSmallIcon
. - [Fixed] iOS timing issue when fetching
motionchange
position after initial#start
-- since the significant-location-changes API (SLC) is engaged in the#stop
method and eagerly returns a location ASAP, that first SLC location could sometimes be several minutes old and come from cell-tower triangulation (ie: ~1000m accuracy). The plugin could mistakenly capture this location as themotionchange
location instead of waiting for the highest possible accuracy location that was requested. SLC API will be engaged only after themotionchange
location has been received. - [Fixed] Headless JS
RNBackgroundGeolocationEventReceiver
was broken inreact-native 0.45.0
-- they removed a mechanism for fetching theReactApplication
. Changed to using a much simpler, backwards-compatible mechansim using simplecontext.getApplicationContext()
. - [Fixed] On Android, when adding a massive number of geofences (ie: thousands), it can take several minutes to perform all
INSERT
queries. There was a threading issue which could cause the main-thread to be blocked while waiting for the database lock from the geofence queries to be released, resulting in an ANR (app isn't responding) warning. - [Changed] Changing the Android foreground-service notification is now supported (you no longer need to
#stop
/#start
the plugin for changes to take effect). - [Added] New config option
httpTimeout
(milliseconds) for configuring the timeout where the plugin will give up on sending an HTTP request. - [Added] Improved
react-native link
automation for iOS. XCode setup is now completely handled! - [Fixed] Android bug in
RNBackgroundGeolocationEventReceiver
. Catch errors whenReactNativeApplication
can not be referenced (this can happen duringstartOnBoot
when the react native App has not yet booted, thus noregisterHeadlessTask
has been executed yet. It can also occur if the plugin has not been configured withforegroundService: true
-- Headless JS requiresforegroundService: true
) - [Fixed] When iOS engages the
stopTimeout
timer, the OS will pause background-execution if there's no work being performed, in spite ofstartBackgroundTask
, preventing thestopTimeout
timer from running. iOS will now keep location updates running at minimum accuracy duringstopTimeout
to prevent this. - [Fixed] Ensure iOS background "location" capability is enabled before asking
CLLocationManager
tosetBackgroundLocationEnabled
. - [Added] Implement ability to provide literal dates to schedule (eg:
2017-06-01 09:00-17:00
) - [Added] When Android motion-activity handler detects
stopTimeout
has expired, it will initiate amotionchange
without waiting for thestopTimeout
timer to expire (there were cases where thestopTimeout
timer could be delayed from firing due likely to vendor-based battery-saving software)
- [Fixed] iOS has a new hook to execute an HTTP flush when network reachability is detected. However, it was not checking if
autoSync: true
or state ofautoSyncThreshold
.
- [Added] When iOS detects a network connection with
autoSync: true
, an HTTP flush will be initiated. - [Fixed] Improve switching between tracking-mode location and geofence. It's not necessary to call
#stop
before executing#start
/#startGeofences
. - Fixed] iOS
maximumAge
withgetCurrentPosition
wasn't clearing the callbacks when current-location-age was<= maximumAge
- [Fixed] iOS when
#stop
is executed, nullify the odometer reference location. - [Fixed] iOS issue with
preventSuspend: true
: When amotionchange
event withis_moving: false
occurred, the event was incorrectly set toheartbeat
instead ofmotionchange
. - [Fixed] Android null pointer exception when using
startOnBoot: true, forceReloadOnBoot: true
: there was a case where last known location failed to return a location. The lib will check for null location in this case. - [Changed] iOS minimum version is now
8.4
. Plugin will log an error when used on versions of iOS that don't implement the methodCLLocationManager#requestLocation
- [Fixed] iOS bug executing
#setConfig
multiple times too quickly can crash the plugin when multiple threads attempt to modify anNSMutableDictionary
- [Fixed] Android was rounding
battery_level
to 1 decimal place. - [Fixed] iOS geofences-only mode was not using significant-location-change events to evaluate geofences within proximity.
- [Changed] iOS now uses
CLLocationManager requestLocation
to request themotionchange
position, rather than counting samples. This is a more robust way to get a single location - [Fixed] iOS crash when providing
null
values inObject
config options (ie:#extras
,#params
,#headers
, etc) - [Fixed] iOS was creating
backgroundTask
inlocation
listener even if no listeners were registered, resulting in growing list of background-tasks which would eventually beFORCE KILLED
. - [Added] New config option
locationsOrderDirection [ASC|DESC]
for controlling the order that locations are selected from the database (and synced to your server). Defaults toASC
. - [Added] Support for React Native "Headless JS"
- [Added] Support for iOS geofence
DWELL
transitions.
- [Fixed] iOS bug when composing geofence data for peristence. Sometimes it appended a
location.geofence.location
due to a sharedNSDictionary
- [Changed] The licensing model of Android now enforces license only for release builds. If an invalid license is configured while runningin debug mode, a Toast warning will appear "BackgroundGeolocation is running in evaluation mode.", but the plugin will work.
- [Fixed] iOS bug with HTTP
401
handling. - [Fixed] Forgot to post updated (backwards-compatible) version of
#getCurrentPosition
method, re-arranging the order of params according to docs:#getCurrentPosition(successFn, failureFn, config)
- [Changed] Refactor Settings Management.
- [Fixed]
geofence
event not passing Geofence#extras
. - [Fixed] iOS geofence identifiers containing ":" character were split and only the last chunk returned. The plugin itself prefixes all geofences it creates with the string
TSGeofenceManager:
and the string-splitter was too naive. Uses aRegExp
replace to clear the plugin's internal prefix. - [Changed] Refactored API Documentation
- [Added] HTTP JSON template features. See HTTP Features. You can now template your entire JSON request data sent to the server by the plugin's HTTP layer.
- [Fixed] Incorrect
peerDependencies
specifiedreact-native >= 0.40.0
- [Changed] Module now works for all versions of react-native, both pre and post
0.40.0
.
- [Fixed] Fix issue with Location Authorization alert popup up when not desired.
- [Fixed] Support for
react-native-0.40.0
- [Added] Ability to provide optional arbitrary meta-data
extras
on geofences. - [Changed] Location parameters
heading
,accuracy
,odometer
,speed
,altitude
,altitudeAccuracy
are now fixed at 2 decimal places. - [Changed] When adding a geofence (either
#addGeofence
or#addGeofences
), if a geofence already exists with the providedidentifier
, the plugin will first destroy the existing one before creating the new one.what was configured. - [Fixed] Improve odometer accuracy. Introduce
desiredOdometerAccuracy
for setting a threshold of location accuracy for calculating odometer. Any location havingaccuracy > desiredOdometerAccuracy
will not be used for odometer calculation. - [Fixed] When configured with a schedule, the Schedule parser wasn't ordering the schedule entries by start-time. Since the scheduler seeks the first matching schedule-entry, it could fail to pick the latest entry.
- [Changed] Add ability to set odometer to any arbitrary value. Before, odometer could only be reset to
0
viaresetOdometer
. The plugin now usessetOdometer(Float, successFn, failureFn
.resetOdometer
is now just an alias forsetOdometer(0)
.setOdometer
will now internally perform a#getCurrentPosition
, so it can know the exact location where the odometer was set at. As a result, using#setOdometer
is exactly like performing a#getCurrentPosition
and thesuccess
/failure
callbacks use the same method-signature, where thesuccess
callback is provided thelocation
- [Fixed] Logic bug in
TSGeofenceManager
; was not performing geospatial query when changing state from MOVING -> STATIONARY. - [Added] Geofences-only mode for both iOS and Android BETA. Start geofences-only mode with method
#startGeofences
. - [Changed] Add some intelligence to iOS motion-detection system: Use a Timer of
activityRecognitionInterval
seconds before engaging location-services after motion is detected. This helps to reduce false-positives, particularly when usingpreventSuspend
while walking around one's house or office. - [Changed] Add more intelligence to iOS motion-detection system: The plugin will be eager to engage the stop-detection, as soon as it detects
still
, regardless of confidence. When the plugin is currently in the moving state and detectsstill
, it will engage a timer ofactivityRecognitionInterval
milliseconds -- when this timer expires and the motion-detector still reportsstill
, the stop-detection system will be engaged. If any moving type activity occurs during this time, the timer will be cancelled. - [Changed] With
preventSuspend: true
, the plugin will no longer immediately engage location-services as soon as it sees a "moving"-type motion-activity: it will now calculate if the current position is beyond stationary geofence. This helps reduce false-positives engaging location-services while simply walking around one's home or office. - [Fixed] iOS
batchSync
: When only 1 record in batch, iOS fails to pack the records in a JSONlocation: []
, appending to alocation: {}
instead.
- [Changed] The plugin will ignore
autoSyncThreshold
when amotionchange
event occurs. - [Fixed] Fixed ui-blocking issue when plugin boots with locations in its database with
autoSync: true
. Found a case where the plugin was executing HTTP Service on the UI thread. - [Fixed] iOS Scheduler puked when provided with a
null
or[]
schedule. - [Changed] iOS Scheduler behaviour changed to match Android, where
#stopSchedule
does not execute#stop
on the plugin itself.
- [Fixed]
getGeofences
issue #158.getGeofences
wasn't migrated to accept the new data-format provided byTSLocationManager
, which now returns anNSArray
ofNSDictionary
-- notCLCircularRegion
. - [Changed] Remove
CocoaLumberjack
static lib fromTSLocationManager
. Compiling it intoTSLocationManager
causes conflicts with others also using this popular logging framework. - [Fixed] Bug exposed with
batchSync
. The plugin was failing to destroy records after successful HTTP request due to bug in FMDB binding array params forDELETE FROM location WHERE id IN(?)
.
- [Added] Implement a mechanism for removing listeners
removeListener
(@aliasun
). This is particularly important for Android when usingstopOnTerminate: false
. Listeners onBackgroundGeolocation
should be removed incomponentDidUnmount
:
componentDidMount() {
BackgroundGeolocation.on('location', this.onLocation);
}
onLocation(location) {
console.log('- Location: ', location);
}
componentDidUnmount() {
BackgroundGeolocation.un('location', this.onLocation);
}
- [Fixed] iOS issue when multiple geofences trigger simultaneously, where only the last one was fired to the client and persisted.
- [Added] Implemented ability for iOS to trigger a geofence
ENTER
event immediately when device is already inside the geofence (Android has always done this). This behaviour can be controlled with the new config@param {Boolean} geofenceInitialTriggerEntry [true]
. This behaviour defaults totrue
.
- [Fixed] Bug in
stopDetectionDelay
logic - [Fixed] Geofencing transistion event logging wouldn't occur when configured for
debug: false
- [Changed] Refactor iOS Logging system to use popular CocoaLumberjack library. iOS logs are now stored in the database! By default, logs are stored for 3 days, but is configurable with
logMaxDays
. Logs can now be filtered by logLevel:
logLevel | Label |
---|---|
0 |
LOG_LEVEL_OFF |
1 |
LOG_LEVEL_ERROR |
2 |
LOG_LEVEL_WARNING |
3 |
LOG_LEVEL_INFO |
4 |
LOG_LEVEL_DEBUG |
5 |
LOG_LEVEL_VERBOSE |
fetch logs with #getLog
or #emailLog
methods. Destroy logs with #destroyLog
.
-
[Fixed]
#emailLog
now finally works. -
[Fixed] If user declines "Motion Activity" permission, plugin failed to detect this authorization failure and fallback to the accelerometer-based motion-detection system.
-
[Changed] Refactored Geolocation system. The plugin is no longer bound by native platform limits on number of geofences which can be monitored (iOS: 20; Android: 100). You may now monitor infinite geofences. The plugin now stores geofences in its SQLite db and performs a geospatial query, activating only those geofences in proximity of the device (@config #geofenceProximityRadius, @event
geofenceschange
). See the new Geofencing Guide
- [Fixed] Bug in preventSuspend during background-fetch event where plugin was left in preventSuspend mode after being rebooted in background.
- [Fixed] Bug in preventSuspend during background-fetch event where plugin was left in preventSuspend mode when not configured to do so.
- [Fixed] Bug in prevent-suspend where the plugin failed to re-start its prevent-suspend timer if no MotionActivity event occurred during that interval. Prevent-suspend system should now operate completely independently of MotionDetector.
- [Fixed]
#stop
method wasn't callingstopMonitoringSignificantChanges
, resulting in location-services icon failing to toggle OFF. Fixes issue #908
- [Fixed]
#removeGeofences
was removing the stationary-geofence. This would prevent stationary-exit if executed while plugin is in stationary-mode. - [Fixed] Accept callbacks to
#stop
method. Fixes #122 - [Added] Add new config
@param {Integer} autoSyncThreshold [0]
. Allows you to specify a minimum number of persisted records to trigger an auto-sync action. - [Fixed] Crash when url configured to
null
. Issue #119 - [Fixed] Missing Javascript API method
beginBackgroundTask
. Issue #109 - [Added] iOS
watchPosition
mechanism. - [Changed] Refactored iOS motion-detection system. Improved iOS motion-triggering when using
CMMotionActivityManager
(ie: when not usingdisableMotionActivityUpdates: true
). iOS can now trigger out of stationary-mode just like android, where it sees a 'moving-type' motion-activity (eg: 'on_foot', 'in_vehicle', etc). Note: this will still occur only when your app isn't suspended (eg: app is in foreground,preventSuspend: true
, or#watchPosition
is engaged). - [Changed] Refactored iOS "prevent suspend" system to be more robust.
- [Fixed] iOS locations sent to Javascript client had a different
uuid
than the one persisted to database (and synced to server).
- [Fixed] Incorrect param signature send to
motionchange
event. Was sending just location-object. Should have been{location: Object, isMoving: Boolean}
- [Added] Stub
#stopWatchPosition
method until it's implemented - [Fixed] Documentation bugs with
addGeofence
,removeGeofence
- [Fixed] Scheduler parsing bug.
- [Added] Add new dependency react-native-background-fetch for improved handling of background-geolocation while app is suspended.
react-native-background-fetch
is managed by Transistor Software. This iOS-only API awakens a suspended iOS app about every 15 min, providing exactly 30s of background running time. background-geolocation uses these events to sync stored locations, check schedule, samples accelerometer for movement (improves motionchange triggering), and determines whether app should havestopOnTerminate
- [Changed] Implement improved location-authorization code with automatic native alert popup directing user to settings to fix the problem. Added new config param
locationAuthorizationAlert
allowing you to configure the strings on the Alert - [Fixed] iOS setting http
method
not being respected (was always doingPOST
).
- [Added] #providerchange method. Fires when user toggles location-services.
- [Changed] Use
TSLocationManager
as a singleton. This may help with issues during development where you reload Javascript, causing multiple instances ofTSLocationManager
to begin recording locations. - [Changed]
#setConfig
acceptssuccess
andfailure
callbacks
- [Changed]
Scheduler
will useLocale.US
in its Calendar operations, such that the days-of-week correspond to Sunday=1..Saturday=7. - [Fixed] iOS Added
event [motionchange|geofence]
to location-data returned toonLocation
event. - [Changed] Refactor odometer calculation for both iOS and Android. No longer filters out locations based upon average location accuracy of previous 10 locations; instead, it will only use the current location for odometer calculation if it has accuracy < 100.
- [Fixed] Missing iOS setting
locationAuthorizationRequest
after Settings service refactor - [Added] new
#getCurrentPosition
options#samples
and#desiredAccuracy
.#samples
allows you to configure how many location samples to fetch before settling sending the most accurate to yourcallbackFn
.#desiredAccuracy
will keep sampling until an location having accuracy<= desiredAccuracy
is achieved (or#timeout
elapses). - [Added] new
#event
typeheartbeat
added tolocation
params (#is_heartbeat
is @deprecated). - [Fixed] When enabling iOS battery-state monitoring, use setter method
setBatteryMonitoringEnabled
rather than setting property. This seems to have changed with latest iOS
- [Changed] Refactor iOS motion-detection system. When not set to
disableMotionActivityUpdates
(default), the plugin will not activate the accelerometer and will rely instead purely upon updates from the M7 chip. WhendisableMotionActivityUpdates
is set tofalse
, the pure acceleromoeter based activity-detection has been improved to give more accurate results of the detected activity (ie:on_foot, walking, stationary
)
- [Fixed] Bugs in iOS option
useSignificantChangesOnly
- [Changed] Refactor HTTP Layer to stop spamming server when it returns an error (used to keep iterating through the entire queue). It will now stop syncing as soon as server returns an error (good for throttling servers).
- [Added] Migrate iOS settings-management to new Settings service
- [Fixed] bugs in Scheduler
- [Changed] Forward declare
sqlite.h
(#76) - [Added] Improved functionality with
stopOnTerminate: false
. Ensure a stationary-geofence is created when plugin is closed while in moving state; this seems to improve the time it takes to trigger the iOS app awake after terminate. When plugin is rebooted in background due to geofence-exit, the plugin will briefly sample the accelerometer to see if device is currently moving.
- [Added] Add schedule to
#getState
- [Added] Introduce new Scheduling feature
- [Changed] ios halt stop-detection distance was using
distanceFilter
; changed to usestationaryRadius
. This effects users using the accelerometer-based stop-detection system: after stop is detected, the device must movestationaryRadius
meters away from location where stop was detected. - [Changed] When
maxRecordsToPersist == 0
, don't persist any record. - [Added] Implement
startOnBoot
param for iOS. iOS always ignoredstartOnBoot
. If you setstartOnBoot: false
now, iOS will not begin tracking when launched in background after device is rebooted (eg: from a background-fetch event, geofence exit or significant-change event) - [Fixed] Missing
heartbeat
event.
- [Fixed] ios
stopOnTerminate
was defaulting tofalse
. Docs say default istrue
. - [Fixed] ios
useSignificantChangesOnly
was broken. - [Added] Add odometer to ios location JSON schema
- [Added] Log network reachability flags on connection-type changes.
- [Added]
maxRecordsToPersist
to limit the max number of records persisted in plugin's SQLite database. - [Added] API methods
#addGeofences
(for adding a list-of-geofences),#removeGeofences
- [Changed] The plugin will no longer delete geofences when
#stop
is called; it will merely stop monitoring them. When the plugin is#start
ed again, it will start monitoring any geofences it holds in memory. To completely delete geofences, use new method#removeGeofences
. - [Fixed] iOS battery
is_charging
was rendering as1/0
instead of booleantrue/false
- [Fixed] Issue with timers not running on main-thread.
- [Fixed] Issue with acquriring stationary-location on a stale location.
- [Fixed] Removed some log messages appearing when
{debug: false}
- [Fixed] getState method
- [Changed] Standardize the Javascript API methods to send both a
success
as well asfailure
callbacks. - [Changed] iOS
emailLog
method will attach the log-file as an email attachment rather than rendering the log to the email body. Email body contains the result ofgetState
now. This standardizes the behaviour between iOS and Android. - [Added] CHANGELOG
- [Added]
@param {Boolean} pausesLocationUpdatesAutomatically [undefined]
. This option allows you to completely disable the stop-detection system by setting this tofalse
. Location-services will never turn off once engaged. When set totrue
, you will engage the iOS default of automatically shutting off location-updates after exactly 15min. When you don't provide a value, the plugin's accelerometer-based stop-detection system will be used, where #stopTimeout will be used to determine when to shut off location-services. This parameter is essentially a tri-state:true
,false
,undefined
. - [Added]
@param {String} locationAuthorizationRequest [Always]
This allows you choose which location-authorization to ask user for:WhenInUse
orAlways
(default). Some developers wish to display the blue top-bar when the app goes to background to show the user their location is being tracked (eg: fitness apps) - [Changed] Refactored logging.
- [Fixed] Bug-fixes and improvements to prevent-suspend mode.
- [Fixed] Refactored iOS persistence layer; better multi-threading support.
- [Fixed]
getCurrentPosition
timeout. - [Changed]
preventSuspend
,heartbeatInterval
to be changed viasetConfig
. - [Changed]
TSReachability
constantkReachabilityChangedNotification
totsReachabilityChangedNotification
to prevent conflicts with other libs. - [Fixed] Location-error handling during prevent-suspend mode.
- [Added] Add methods
#getCount
and#insertLocation
(for manually adding locations to plugin's SQLite db) - [Added] Document
#maxBatchSize
config (limits number of records per HTTP request when usingbatchSync: true
- [Fixed] Fixed bug in
maxDaysToPerist
- [Added] Implemented new
#getLog
,#emailLog
methods for fetching the current application log at runtime.