SQLite plugin vs localStorage (localStorageService)


#1

I need to put some data on the device (Android, iOS, WP and maybe BB10)

and i have some question about this

¿what is the best method to use? (performance is priority)

  • SQLite plugin.
  • localStorage (localStorageService handler the localStorage ?)

I need to think if the user are using external sd card to storage the data?
The user can remove or clean the data?

Thanks in advance


#2

What kind of data do you wanna save, if you want a very simple kind of data to be storage, that could be just {'key':'value'} the localStorage could serve you, but if you need to store more complex data, with relation between then, maybe SQLite is better, I think you need to research about both of them and select the best approach to you. Your question is so general, I can’t give you an answer that could be your “silver bullet”


#3

look at localforage - basically localstorage backup by indexdb or websql if avail


#4

Also give a check:


#5

You can use Web SQL Database (Web Sql is basically sqlite embedded into the browser) to manage complex relational database. AS in-app browser of Android, IOS and Blackberry supports Web SQL, you can use it without any plugin. See caniuse.com for the latest compatibility tables.

Do ‘inspect element’ in Google Crome and in ‘Resources’ tab, you cab see Web SQL. You can easily test your app in PC or Mac before compiling to App.

However, As Cordava uses IE Mobile browser in Windows Phone, WebSql doesn’t work there.

As per my experience ‘localStorage’ fetches data bit faster than Web SQL.


#6

@Norwill Would like know if localStorage or sessionStorage is supported in Mobile device which are not HTML5 compatible. Since localStorage is HTML5 component/API ?

Please Help.

Thanks


#7

You need use SQLite if you need persistence and save big data: https://github.com/jdnichollsc/Ionic-Starter-Template

Regards, Nicholls


#8

SQLite plugin stores data into device or directly in browser?