Closed geongun20 closed 1 year ago
I'm developing running app. I use javascript axios library to update locations to my server.
I'm refactoring use http option in this library to solve background issue.
autoSyncThreshold is ignored during onMotionChange events.
It is active only when the device is moving.
@christocracy Thanks for your answer. So, how can I enable autoSyncThreshold? set isMoving to false?
how can I enable autoSyncThreshold?
By setting a value > 0.
while the device is in the moving state, autoSyncThreshold will be respected.
@christocracy My simulator is always in the moving state. But autoSyncThreshold is not walking.
When the plugin accumulates >= autoSyncThreshold records in its SQLite database, the plugin automatically initiates an http request to flush those records to your configured url.
I suggest you test it with a higher value in the simulator, since distanceFilter: 1 is going to record a lot of records very quickly.
Or increase distanceFilter (Eg 50).
Your Environment
react-native -v
): 0.68.1Under method is called when user starts running
public async start(running_id: string) { await BackgroundGeolocation.setConfig({ url:
${API_URL}/users/me/runnings/${running_id}/locations
, method: "POST", httpRootProperty: "locations", autoSync: true, autoSyncThreshold: 5, batchSync: true, params: { session_id: uuid() }, }); await BackgroundGeolocation.start(); const [location] = await Promise.all([ BackgroundGeolocation.getCurrentPosition({ samples: 3, maximumAge: 3000, }), BackgroundGeolocation.changePace(true), ]);}