5.0.0-beta #2431
christocracy
announced in
Announcements
5.0.0-beta
#2431
Replies: 3 comments
-
|
Migration Steps
Typo? References to Dart? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thanks, fixed. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
I'll be publishing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🚀 Migration Guide: Flat Config → Compound Config
📢 Overview
Version 5 introduces a new Compound Config format that replaces the legacy “flat” config structure. This guide explains how to migrate, shows before/after examples, and highlights key differences for the React Native SDK.
⚙️ Compatibility
The legacy flat config style remains fully supported for backward compatibility.
You can continue using your existing flat configuration if you prefer, though new features may only appear in the compound structure.
⏩ Why Compound Config?
@transistorsoft/background-geolocation-types.🏗️ Old vs. New Config Structure (React Native)
Before (Flat Config – JS/TS)
After (Compound Config)
🗺️ Mapping Table: Flat → Compound
desiredAccuracygeolocationdesiredAccuracygeolocation: GeoConfig(desiredAccuracy: ...)distanceFiltergeolocationdistanceFilterstopOnTerminateappstopOnTerminateapp: AppConfig(stopOnTerminate: ...)startOnBootappstartOnBooturlhttpurlhttp: HttpConfig(url: ...)headershttpheaderslogLevelloggerlogLevellogger: LoggerConfig(logLevel: ...)debugloggerdebug🧑💻 Migration Steps
Update your dependency:
Ensure you are using
react-native-background-geolocationv5.0.0 or later.Import as before:
Group related options:
GeoConfigHttpConfigLoggerConfigAppConfigActivityConfigPersistenceConfigReplace flat keys:
Config(...)directly, pass the relevant compound config objects.Check for breaking changes:
📝 Example Migration
Flat Config (Old)
Compound Config (New)
🧩 Compound Config Groups
geolocationGeoConfigappAppConfighttpHttpConfigloggerLoggerConfigactivityActivityConfigpersistencePersistenceConfigEach group is a separate Typescript interface. See API docs for details.
🛠️ Full Mapping Table
desiredAccuracygeolocationdesiredAccuracydistanceFiltergeolocationdistanceFilterstationaryRadiusgeolocationstationaryRadiusstopTimeoutgeolocationstopTimeoutstopAfterElapsedMinutesgeolocationstopAfterElapsedMinutesgeofenceProximityRadiusgeolocationgeofenceProximityRadiusgeofenceInitialTriggerEntrygeolocationgeofenceInitialTriggerEntrygeofenceModeHighAccuracygeolocationgeofenceModeHighAccuracypausesLocationUpdatesAutomaticallygeolocationpausesLocationUpdatesAutomaticallyshowsBackgroundLocationIndicatorgeolocationshowsBackgroundLocationIndicatoractivityTypegeolocationactivityTypelocationAuthorizationAlertgeolocationlocationAuthorizationAlertmaxMonitoredGeofencesgeolocationmaxMonitoredGeofencesfiltergeolocationfilterstopOnTerminateappstopOnTerminatestartOnBootappstartOnBootenableHeadlessappenableHeadlessheartbeatIntervalappheartbeatIntervalscheduleappschedulescheduleUseAlarmManagerappscheduleUseAlarmManagernotificationappnotificationbackgroundPermissionRationaleappbackgroundPermissionRationalepreventSuspendapppreventSuspendurlhttpurlautoSynchttpautoSyncautoSyncThresholdhttpautoSyncThresholddisableAutoSyncOnCellularhttpdisableAutoSyncOnCellularbatchSynchttpbatchSyncmaxBatchSizehttpmaxBatchSizemethodhttpmethodparamshttpparamsheadershttpheadersrootProperty/httpRootPropertyhttprootPropertytimeout/httpTimeouthttptimeoutdebugloggerdebuglogLevelloggerlogLevelLogLevellogMaxDaysloggerlogMaxDaysactivityRecognitionIntervalactivityactivityRecognitionIntervalminimumActivityRecognitionConfidenceactivityminimumActivityRecognitionConfidencedisableStopDetectionactivitydisableStopDetectionstopOnStationaryactivitystopOnStationarymotionTriggerDelayactivitymotionTriggerDelaytriggerActivitiesactivitytriggerActivitiesdisableMotionActivityUpdatesactivitydisableMotionActivityUpdatesstopDetectionDelayactivitystopDetectionDelaypersistModepersistencepersistModemaxDaysToPersistpersistencemaxDaysToPersistmaxRecordsToPersistpersistencemaxRecordsToPersistlocationsOrderDirectionpersistencelocationsOrderDirectionNew License Key Format
A new license key format has been introduced for
v5. Also, iOS now requires a license key. Generate your new license keys in the Customer Dashboard. See the usual Setup Guides for license setup instructions.logLevelis now aLogLevelenum (e.g.,LogLevel.info), but legacy integer values are still supported for backward compatibility. You may use either the new enum or the legacy integer type.debugis now inLoggerConfig.🧪 Testing Your Migration
🆘 Need Help?
📚 Resources
🎉 Happy Migrating!
If you have suggestions for improving this guide, please open a PR or issue.
Beta Was this translation helpful? Give feedback.
All reactions