I am using IonicFramworks to build an Android App, the android app is using SQLlite via the webSQL interface (Cordova-SQLitePlugin);
The current limit is set to 4194304 bytes;
Is there a way to have the current DB "used" size or "remaining" size or trigger an error if the max size is reached ?
I found out ways to know the available size in the memory/SD card, are they related?
Methode 1
cordova.exec(win, fail, "File", "getFreeDiskSpace", []);
Method 2
cordova.exec(
function(freeSpace) {
alert('reported free space is ' + freeSpace);
},
function() {
alert('failed');
},
"File", "getFreeDiskSpace", []
);
Method 3
function availableBytes(callback, start, end){
callback = callback == null ? function(){} : callback
start = start == null ? 0 : start
end = end == null ? 1 * 1024 * 1024 * 1024 * 1024 : end //starting with 1 TB
limit = 1024 // precision of 1kb
start_temp = start
end_temp = end
callback_temp = callback
if (end - start < limit)
callback(start)
else{
window.requestFileSystem(LocalFileSystem.PERSISTENT, parseInt(end_temp - ((end_temp - start_temp) / 2)), function(fileSystem){
setTimeout(function(){
availableBytes(callback_temp, parseInt(parseInt(end_temp - ((end_temp - start_temp) / 2))), end_temp)
}, 0)
}, function(){
setTimeout(function(){
availableBytes(callback_temp, start_temp, parseInt(end_temp - ((end_temp - start_temp) / 2)))
}, 0)
})
}
}
I found out about these methods in here, but it says nowhere if its taking in account the databse.