Search code examples
javascriptandroidcordovaphonegap-buildcordova-plugins

Cordova/Phonegapp - How to use Local Storage Plugin


I'm using cordova for the first time to develop apps for android. i have installed cordova local storage plugin.

But i don't know how to use it(what java-script code is to be used). What i'm making is a To-do list app,so i need to store the strings or whatever the user inputs.

can anyone please post a short example demonstrating the same. Thanks in advance.


Solution

  • You don't need localStorage plugin to use simple html localStorage.You can simply save and retrieve value without any plugin.

    For saving:

    localStorage.setItem("key",value);
    

    for retrieving:

    localStorage.getItem("key");
    

    You can save upto 5mb per app with local storage.

    You can use web sql too. WEB SQL example link It also does not need any plugin.

    Then you can use a bit advanced SQL wrappers. This one needs plugin to be installed. Brodysoft SQLite with complete documentation