【问题标题】:Delete App DB present in mobile from the App using cordova使用cordova从应用程序中删除移动设备中存在的应用程序数据库
【发布时间】:2013-05-17 09:17:25
【问题描述】:

我想在发生某些特定事件时从应用中删除与我的应用相关的完整数据库。

我怎样才能做到这一点?我正在使用 cordova 构建我的应用,我的应用同时适用于 Android 和 iOS 平台。

【问题讨论】:

  • 数据库存储在哪里?
  • 在移动端的文件系统中
  • 好的。因为它只是一个文件- fileentry.remove(success, fail);应该可以正常工作。

标签: android ios database cordova


【解决方案1】:

试试这样的:

function removefile(){
    fileSystem.root.getFile("/data/data/YourPackage/databases/YouDbName.db", {create: false, exclusive: false}, gotRemoveFileEntry, fail);
}

function gotRemoveFileEntry(fileEntry){
    console.log(fileEntry);
    fileEntry.remove(success, fail);
}

function success(entry) {
    console.log("Removal succeeded");
}

function fail(error) {
    console.log("Error removing file: " + error.code);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 1970-01-01
    • 2013-12-11
    • 1970-01-01
    • 2021-06-02
    • 1970-01-01
    相关资源
    最近更新 更多