Configure Cordova SQLite Storage

4

I am not able to configure the Cordova SQLite Storage plugin. The steps I follow are:

  • Install the plugin with phonegap plugin add https://github.com/litehelpers/Cordova-sqlite-storage
  • Copy SQLitePlugin.js from within the plugin folder.
  • I configured the following permissions:
  • AndroidManifest.xml :

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    

    Then I'll make the call:

    var db = window.sqlitePlugin.openDatabase({name: "my.db", location: 1});
    

    There you give an error, stating that you are not reporting that the database could not be opened. I do not know if any configuration is missing.

    Has anyone ever been through anything like this?

        
    asked by anonymous 17.04.2015 / 22:30

    2 answers

    1

    A little late for an answer but maybe it helps. If you are trying to run the application in the browser it will not work. You need to run the application on your phone and debug the chrome.

    cordova run android -1
    

    and in chrome access   chrome://inspect

        
    17.02.2016 / 17:58
    0

    On the Plugin site it indicates that the function to be used is sqlitePlugin.openDatabase () without the window in front. Another point is that this flame only works after the deviceready () event.

    As far as I understand in the documentation you have to create a sqllite file in another application like SQLliteBrowser and put the file created in the www directory.

    I have the environment installed on my machine and tried to replicate the example you passed, and despite all the above attempts I am also having the same error, which could indicate a Bug in the Plugin.

        
    18.04.2015 / 02:29