an-rahulpandey / cordova-plugin-dbcopy

Copy SQLite Database from www folder to default app database location
Apache License 2.0
89 stars 47 forks source link

copyDbFromStorage stopped working #43

Closed dunkindohnuts closed 7 years ago

dunkindohnuts commented 7 years ago

Hi,

I'm using copyDbFromStorage to copy a database from a location under cordova.file.dataDirectory but the copy does not work. The success callback is being called with ' JSON error' passed to it.

Thanks

an-rahulpandey commented 7 years ago

Can you post the code, how you are using, since there has been some changes in the code. please have a look at Readme file also.

dunkindohnuts commented 7 years ago

This is the code I'm running on an Android device. I've looked on the device and the db file trying to be copied does exist. However, I did notice that if you specify a file which doesn't exist you get the same behaviour, ie the success callback is invoked. The response being passed to the callback is a string and not a JSON object. The response says JSON error.

Thanks

var dbName='test.db'; var dir='test';

window.plugins.sqlDB.copyDbFromStorage(dbName,0,cordova.file.dataDirectory + dir + "/" + dbName,true, function(response){ console.log(response); // This prints out JSON error console.log('dbase installed'); }, function(response){ console.log('error installing database'); }); }

an-rahulpandey commented 7 years ago

Can you use Android Monitor tool and post the Java log?

an-rahulpandey commented 7 years ago

Reopen it, if you still facing issue.