I am trying to get a list of the databases that my Android SQLite program is working with. If I understand correctly, the databases are in:
data/data/[packagename]/databases
the databases are created using:
SQLiteDatabase.execSQL(DATABASE_CREATE);
And then I try to get a list using:
String[] instrumentFileList = MainActivity.this.fileList();
However, this returns a null array. I know the SQL database is being created because other parts of my app are able to access it. Is this failure to get a list because my phone is not rooted?
Also, is there a way to get a list of files in that directory using adb?
Any help is greatly appreciated.
How is the implementation of your method fileList()? Every database is stored in a separated file under /data/data/[packagename]/databases, usually the database name will suffix with ".db", you could achieve this by just list this directory.
If you want to list the database file from adb, you can do like that
In some situation, it might not work because of permission restriction, however you can set the database directory permission to world readable in you application.