Firebase does not sync offline cache if the app is killed

Works like a charm , see what i did.

    ---actions when app is offline---
  • 1. Added 4 entries
  • 2. App killed
  • 3. edited 1 entry
  • 4. App killed
  • 5. Delete one entry
  • 6. App killed
  • 7. App starts this time with internet connection
  • Data was perfectly synched. I have used 4 lines of firestore magic

    FireBase Database

     //Firebase Database Magic lines
        val firebaseDatabase: FirebaseDatabase = FirebaseDatabase.getInstance()
        firebaseDatabase.setPersistenceEnabled(true)
        val firebaseDatabase: FirebaseDatabase= firebaseDatabase.getReference("Prakash")
        databaseReference.keepSynced(true)
    

    According to firebase documentation

    Transactions are not persisted across app restarts

    Even with persistence enabled, transactions are not persisted across app restarts. So you cannot rely on transactions done offline being committed to your Firebase Realtime Database. To provide the best user experience, your app should show that a transaction has not been saved into your Firebase Realtime Database yet, or make sure your app remembers them manually and executes them again after an app restart.