-
Notifications
You must be signed in to change notification settings - Fork 441
Open
Description
Required Reading
- Confirmed
Plugin Version
5.0.3
Mobile operating-system(s)
- iOS
- Android
Device Manufacturer(s) and Model(s)
iPhone 17 pro max
Device operating-systems(s)
iOS 26.2.1
React Native / Expo version
"react-native": "0.81.5", "expo": "54.0.25"
What do you require assistance about?
We're having issues with getting updated location information when the application is killed by the user in iOS. As far as we understand things, the application should re-awake and start pushing location information again after breaking the ~200m geofence that is set when the app is killed. We're not seeing that re-awake after ~200m, but we do see it happen when you enter or exit other geofences (but then it goes back to a terminated state after 10-30 seconds).
[Optional] Plugin Code and/or Config
async function configureBackgroundGeolocation(): Promise<State> {
if (isConfigured) {
return BackgroundGeolocation.getState();
}
// Get the API URL for native HTTP sync
const apiUrl = API_URL || "";
const uploadUrl = apiUrl ? `${apiUrl}/locations/upload` : "";
// Get auth token for initial configuration
const token = await AsyncStorage.getItem(STORAGE_KEYS.AUTH_TOKEN);
const state = await BackgroundGeolocation.ready({
geolocation: {
desiredAccuracy: BackgroundGeolocation.DesiredAccuracy.High,
distanceFilter: 2,
disableStopDetection: false,
stopTimeout: 60,
stationaryRadius: 25,
disableElasticity: false,
activityType: BackgroundGeolocation.ActivityType.OtherNavigation,
showsBackgroundLocationIndicator: true,
pausesLocationUpdatesAutomatically: false,
locationAuthorizationRequest: "Always",
},
activity: {
motionTriggerDelay: 0,
disableMotionActivityUpdates: false,
},
app: {
stopOnTerminate: false,
startOnBoot: true,
enableHeadless: true,
heartbeatInterval: 60,
preventSuspend: true,
},
http: {
url: uploadUrl,
autoSync: true,
autoSyncThreshold: 0,
batchSync: false,
maxBatchSize: 1,
headers: {
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
rootProperty: '.',
},
persistence: {
locationTemplate: '{"latitude":<%= latitude %>,"longitude":<%= longitude %>,"altitude":<%= altitude %>,"accuracy":<%= accuracy %>,"speed":<%= speed %>,"heading":<%= heading %>,"timestamp":"<%= timestamp %>","motion_state":"<%= activity.type %>","battery_level":<%= battery.level %>,"battery_charging":<%= battery.is_charging %>}',
maxDaysToPersist: 3,
},
logger: {
debug: true,
logLevel: BackgroundGeolocation.LogLevel.Verbose,
},
});
isConfigured = true;
console.log("[BackgroundLocation] Configured with native HTTP sync:", {
enabled: state.enabled,
url: uploadUrl,
hasToken: !!token,
});
// Apply geofence-specific settings for iOS reliability
try {
await BackgroundGeolocation.setConfig({
geofenceInitialTriggerEntry: true,
geofenceProximityRadius: 1000,
} as any);
console.log("[BackgroundLocation] Geofence settings applied");
} catch (err) {
console.error("[BackgroundLocation] Failed to apply geofence settings:", err);
}
return state;
}[Optional] Relevant log output
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels