I build and run application in android device. My application use ng-cordova in ionic framework.In service.js , I have
$rootScope.db = $cordovaSQLite.openDB("MyApp.db");
And at here, i don’t know path of database sqlite in android device ,
I open android device ,and discovery at Internal
Storage>Android>data>com.ionicframework.myapp596823>cache
folder and files folder . I can not see database MyApp.db.
The problem in here , i want to download new database and rewrite old
database, but i don’t know direct path of database . In controller.js
$scope.downloadFileDB = function () {
var url = "https://www.dropbox.com/s/jwrqd9rwk82yon5/MyApp.db";
var filename = url.split("/").pop();
//var targetPath = cordova.file.externalRootDirectory + "/Android/data/com.ionicframework.myapp596823/files/" + filename;
//var targetPath = cordova.file.externalRootDirectory + filename;
//var targetPath = cordova.file.dataDirectory + filename;
var trustHosts = true
var options = {};
$cordovaFileTransfer.download(url, targetPath, options, trustHosts)
.then(function (result) {
alert("Success " + JSON.stringify(result));
}, function (error) {
alert("Error " + JSON.stringify(error));
}, function (progress) {
$timeout(function () {
$scope.downloadProgress = (progress.loaded / progress.total) * 100;
})
});
}
If you know path of database , tell me.Thank you so much.