Pierre
Pierre

Reputation: 465

Android database location in app directory

I don't understand why database files are stored in the android emulator or phone in the data folder data/data//databases rather than being stored in the application that uses it.

Logically, the database file must also be stored in the android app, right ?

If yes, where should it be stored in the app directory ?

Upvotes: 0

Views: 887

Answers (2)

Kosh
Kosh

Reputation: 6334

your database will be saved under data/data/myApp/database and not in any other folder but your application folder, since database consider as a private to your app, android make it hard for people with non-root access to see your database. you still can store it in any place you like just point to it from your app.

Upvotes: 1

Noor
Noor

Reputation: 20140

Put your database in your assets folder, then its path is given by "/data/data/<your-package-name>/databases/<dbname>"

Upvotes: 0

Related Questions