Clear firebase persistence after logout
Unfortunately there's no supported way to clear the persistence cache. You could try to manually delete the SQLite database used by Firebase Database (should be under /databases/
in your app's data folder), but you'd need to do it before initializing Firebase Database, so you'd have to force the app to restart after signing somebody out or similar.
Regarding knowing if there's "data waiting to sync", assuming you're talking about writes, the only way is to attach CompletionListeners to every write operation you do, and wait for them to complete.
Both of these are things we'd like to improve in future versions of the Firebase Database SDK.
clearPersistence()
was launched in v6.2.0.
via
https://github.com/firebase/firebase-js-sdk/issues/449