Ionic Local Storage?


#1

Hey I am making a Survey Application in which Surveyee’s Data is stored in Local Database(when in offline mode) and when internet is available it sends all data to MySql Database.
What Local storage should i use ? What should be my approach ?
Thank You


Loops on Ion-HTML page
#2

I am using Ionic Storage with sqlite (plugin) for the exact same purpose (on and offline surveys), but use Firebase for the online version


#3

@Tommertom Do you have any code sample ??? I am stuck in it… Demo for the Offline function.


#4

Well that is company code…

Enabling ipnic storage on sqlite is documented on this website. So that is easy

Then it is a matter of data modelling. I put the data in an object which I set in the storage. Before doing so, I stringify it and the use aes to encrypt.

So basically I am storing an encrypted string representation as an object in Ionic Storage

No sql

Aes encryption through CryptoJS. I posted these routines earlier on this forum

Tom


#5

#6

Thanks but i think its more confusing… Even a little bit of code for saving data into local and sending it to online database would be very helpful :stuck_out_tongue:


#7

Great!! Confusion is good

I separate the online and offline, so no real syncing and stuff

So hard work manual stuff in my code: storing locally, checking for online capability and then use other routines to store online.

All the above are well documented patterns as separate blocks

Others will recommmend using Firestore or angularfire2offline so the magic happens under the hood. But I need sqlite for local storage for persistence and large quantities of data

Coding is rewarding but hard work, my friend :grinning::grinning:

Tom