[ERROR] Native-storage plugin is not installed

I am using native storage plugin to store the needed data. I have successfully installed that plugin in my ionic project but when i run my project in browser ,it’s throwing warnings that plugin is not installed.
image

As you can see here, i have successfully installed nativestorage plugin.

image

I have wrapped up my native-storage code inside platform.ready() event.
how to clear all those warnings?

Native plugins work in native environments. Not in the browser.

It’s still not working as expected.

Here is the code where i am using nativestorage.

this.nativeStorage.getItem('userID')
      .then( (data)=> {
        console.log(data);
        this.userID = data;
         alert(data + "success");
      },(error)=> {
        console.log(error);
        alert(error + "fail"); // this alert is generated
      })

It’s generating error that “cordova_not_available fail”.
I built .apk file and tested on real device.

Can you tell me what i am doing wrong?

Perhaps you are not waiting for Platform.ready(), but I really think you should take a look at using ionic-storage instead. It works in browsers too, for one thing.

1 Like