Open stihl-sicher opened 6 years ago
Can you get the database file statistics from File plugin?
Hi,
I think I have same problem, when I try to open database on SDCard from here file:///storage/emulated/0/Android/data/<...>/files/myDb
And I still doesn't understand why it creates an empty database on local storage, /Android/data/<..>/files/myDb
Here is my JS code, nothing fancy :
window.resolveLocalFileSystemURL(
cordova.file.externalDataDirectory,
function (externalDataDirectoryEntry) {
console.log(externalDataDirectoryEntry.toURL())
// return : "file:///storage/emulated/0/Android/data/<...>/files/"
var db = window.sqlitePlugin.openDatabase({
name: db_name,
androidDatabaseLocation: externalDataDirectoryEntry.toURL(),
});
(...)
If I read file with
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory + db_name (...)
I get a clean fileEntry :
fullPath:"/myDb"
isDirectory:false
isFile:true
name:"myDb"
nativeURL:"file:///storage/emulated/0/Android/data/<...>/files/myDb"
If I put my database directly in the internal storage at /Android/data/<..>/files/myDb, everthing working fine ... Is there something I missing ?
Thanks for your help !
Hi,
I want to open an MBTiles-File (which is an sqlite database) from the sd card. I have got the path and it can be resolved by the File-Plugin. So I try to open the database using the parameter "androidDatabaseLocation" as described. This results in opening the database from internal storage. Opening files from any location in internal storage works perfect that way. But trying to read from sd card replaced the sd card with internal storage. Does anyone have an idea for me? Actually testing on Samsung Galaxy Tab Active2, Android 7.1. External write permission is set in the manifest file.