From 72b978d5867bdac71cc2cfac038adcefc701cd0e Mon Sep 17 00:00:00 2001 From: Beng Tan Date: Mon, 29 Oct 2018 14:40:55 +0800 Subject: [PATCH] Configure startOnBoot,stopOnTerminate with setConfig(). --- src/store/LocationStore.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/store/LocationStore.ts b/src/store/LocationStore.ts index bb4ff86d8..4b77831db 100644 --- a/src/store/LocationStore.ts +++ b/src/store/LocationStore.ts @@ -268,15 +268,26 @@ const LocationStore = types debug: false, // logLevel: backgroundGeolocation.LOG_LEVEL_VERBOSE, logLevel: backgroundGeolocation.LOG_LEVEL_ERROR, - stopOnTerminate: false, - startOnBoot: true, + // stopOnTerminate: false, + // startOnBoot: true, url, autoSync: true, params, headers, }) - // apply this change every load to prevent stale auth headers - yield backgroundGeolocation.setConfig({headers, params, url}) + + // .ready() doesn't always apply configuration. + // Here are some things that we have to configure everytime. + // Note: If any user-configurable/debug settings appear here, + // they will be overwritten + yield backgroundGeolocation.setConfig({ + startOnBoot: true, + stopOnTerminate: false, + headers, + params, + url, + }) + logger.log(prefix, 'is configured and ready: ', state) self.updateBackgroundConfigSuccess(state)