Search code examples
androidioscordovaionic-frameworkcordova-nativestorage

Can you use Native Storage on Ionic 1?


I see there is a Native Storage on Ionic 2, but I didn't see a Native Storage for Ionic 1 and wasn't sure if I was just missing it, or if it didn't exist.

I'm aware of Sql lite, and other similar solutions, but I was hoping to avoid having to add that in to our app if we didn't need it, since we're going to eventually move to Ionic 2, but we have an immediate need for persistent storage.


Solution

  • Yes you can use it. It is a cordova plugin.

    Just use cordova plugin add cordova-plugin-nativestorage

    And then you can use :

    NativeStorage.setItem("reference", obj, setSuccess, setError);
    

    See the docs : https://github.com/TheCocoaProject/cordova-plugin-nativestorage