Reputation: 15922
I've created a simple APP to add some data in a database. While I was testing on Linux Chrome browser, I had no problem accessing to the database itself (path .config/google-chrome/Default/databases/http_localhost_8383/
) but now I'm testing on a real Android device and I can't find the file that the APP is generating.
Note that I'm using a root browser on a rooted device.
Upvotes: 0
Views: 298
Reputation: 86
maybe this can be helpful:
if (android.os.Build.VERSION.SDK_INT >= 17) {
DB_PATH = xcontext.getApplicationInfo().dataDir + "/databases/";
} else {
DB_PATH = xcontext.getFilesDir().getPath() + "data/" +
xcontext.getPackageName() + "/databases/";
}
or:
if (android.os.Build.VERSION.SDK_INT >= 17) {
DB_PATH = xcontext.getApplicationInfo().dataDir + "/databases/";
} else {
DB_PATH = "/data/data/" + xcontext.getPackageName() + "/databases/";
}
Upvotes: 0
Reputation: 1337
You are correct, the db should be located at '/data/data/' + this.packageName + '/databases/' + dbName Are you sure it's being created? And to quote brodybits "When the app calls sqlitePlugin.openDatabase(), the plugin will create the database file if it does not exist, or read the database file if it does exist. For each platform, the database file should be in the same path (relative to your app) regardless whether you are running it on an emulator or on a real device."
It sounds like to me that you're using the browser database plugin, instead based on the location of your database.
Chrome save its db's in ~/.config/google-chrome/Default/databases but it's not the same as cordova's sqlite plugin cordova-sqlite-storage.
Upvotes: 1