Offline persistence after app restart

Currently I had an issue about offline persistence (on iOS)
First I call an update request (while offline) like

firebase.database()
    .ref('my_ref')
    .set(myData)
    .then(() => {
      resolve('Synchronization success');
    })
    .catch(err => {
      reject('Synchronization fail');
    })

I’m sure that firebase had store myData locally (I can get value from my_ref) and after app gains connection again or soft restart (tap Home button -> tap App icon to reopen), myData is uploaded to remote. But when app is completely shut down (double tap Home button -> swipe App away) then reopen, Firebase doesn’t upload myData

Is this a wrong behavior or am I missing something?

1 possible answer(s) on “Offline persistence after app restart

  1. @Leeds-eBooks afaik .keepSynced() prevents it from being evicted out the persistent disk cache, the disk cache has a maximum capacity of 10mb, if that’s reached evictions of stale/least used data is done. Without it but with persistence enabled it still will work – unless the cache is full and it gets evicted. And of course it will keep the data fresh, whereas without it persisted data is only updated when accessed via a ref.

Offline persistence after app restart

Currently I had an issue about offline persistence (on iOS)
First I call an update request (while offline) like

firebase.database()
    .ref('my_ref')
    .set(myData)
    .then(() => {
      resolve('Synchronization success');
    })
    .catch(err => {
      reject('Synchronization fail');
    })

I’m sure that firebase had store myData locally (I can get value from my_ref) and after app gains connection again or soft restart (tap Home button -> tap App icon to reopen), myData is uploaded to remote. But when app is completely shut down (double tap Home button -> swipe App away) then reopen, Firebase doesn’t upload myData

Is this a wrong behavior or am I missing something?

1 possible answer(s) on “Offline persistence after app restart

  1. @Leeds-eBooks afaik .keepSynced() prevents it from being evicted out the persistent disk cache, the disk cache has a maximum capacity of 10mb, if that’s reached evictions of stale/least used data is done. Without it but with persistence enabled it still will work – unless the cache is full and it gets evicted. And of course it will keep the data fresh, whereas without it persisted data is only updated when accessed via a ref.

Offline persistence after app restart

Currently I had an issue about offline persistence (on iOS)
First I call an update request (while offline) like

firebase.database()
    .ref('my_ref')
    .set(myData)
    .then(() => {
      resolve('Synchronization success');
    })
    .catch(err => {
      reject('Synchronization fail');
    })

I’m sure that firebase had store myData locally (I can get value from my_ref) and after app gains connection again or soft restart (tap Home button -> tap App icon to reopen), myData is uploaded to remote. But when app is completely shut down (double tap Home button -> swipe App away) then reopen, Firebase doesn’t upload myData

Is this a wrong behavior or am I missing something?

1 possible answer(s) on “Offline persistence after app restart

  1. @Leeds-eBooks afaik .keepSynced() prevents it from being evicted out the persistent disk cache, the disk cache has a maximum capacity of 10mb, if that’s reached evictions of stale/least used data is done. Without it but with persistence enabled it still will work – unless the cache is full and it gets evicted. And of course it will keep the data fresh, whereas without it persisted data is only updated when accessed via a ref.

Offline persistence after app restart

Currently I had an issue about offline persistence (on iOS)
First I call an update request (while offline) like

firebase.database()
    .ref('my_ref')
    .set(myData)
    .then(() => {
      resolve('Synchronization success');
    })
    .catch(err => {
      reject('Synchronization fail');
    })

I’m sure that firebase had store myData locally (I can get value from my_ref) and after app gains connection again or soft restart (tap Home button -> tap App icon to reopen), myData is uploaded to remote. But when app is completely shut down (double tap Home button -> swipe App away) then reopen, Firebase doesn’t upload myData

Is this a wrong behavior or am I missing something?

1 possible answer(s) on “Offline persistence after app restart

  1. @Leeds-eBooks afaik .keepSynced() prevents it from being evicted out the persistent disk cache, the disk cache has a maximum capacity of 10mb, if that’s reached evictions of stale/least used data is done. Without it but with persistence enabled it still will work – unless the cache is full and it gets evicted. And of course it will keep the data fresh, whereas without it persisted data is only updated when accessed via a ref.