I am writing a chat app in Ionic 2. I want to save some of the the messages locally on the phone.
I am using Firebase as the messaging system. It stores the messages in JSON notation. When I read a message I want to store it locally and delete it from Firebase
Should I use SQLite or Local Storage?
I would normally say SQLite bexcuse it's more reliable, but because Firebase uses JSON, should I rather store the local messages as JSON in Local Storage?
Any advise appreciated.
Because you are using Ionic, I would suggest that you use the ionic-storage module.
By default it uses the most advanced storage mechanism available. So in Chrome, it will use IndexedDB and fall back to WebSQL or LocalStorage.
If you install the cordova-sqlite-storage plugin, ionic-storage will use sqlite as the storage engine when running on the device.
You can only store key-value pairs using ionic-storage, so you can't use custom sql-queries. But storing JSON works without any modifications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With