Search code examples
sqlitecordovaphonegap-pluginscordova-plugins

How to get db file path in java Script Cordova app


I have an application which is developed in cordova latest version.I am using sqlite database and I want to copy the db file to internal sdcard of mobile device.How can i get the db file path in javaScript (I don't want to give static path 'data/data//databases').


Solution

  • Install this plugin from below link.

    https://github.com/jamirooo/DatabasePath-cordova

    And try below javascript code. It will give you database path.

    getDatabasePath: function (callback) {
        cordova.exec(callback, function(err){
            alert(err);
        }, "DatabasePath", "getDatabasePath", []);
    }