I want to open the database of another app. I know I must have root-access, but it seems that root access is "only" for shell commands.
I want to make a lot of selects and some inserts into the database. Is it possible to open the db as root, and work with the db-handle in the "normal" app?
Thanks in advance
Biber
You don't need the root access and shell, if these two apps have an
sharedUsersId
tag with same value in Manifest:and in app, where you want to access the
app.you.want.to.share
app you must create a Context:then you can use it in DB adapter, etc:
thanks for all answers! I think the only way is to make something like this:
Then, I must parse the OutputStream with a cvs parser,.... I hoped I can do it in a simpler way, but I see no solution.
Maybe I can create a hard link to a file in a directory of my app, but it is very dangerous, because in that way there are two ".journal" files for one db.
Thanks for help
Biber
You still can access the database if you have the root access through shell commands :
Example :
The tool used is sqlite3 which is a client command to an sqlite database. The database files are usually located in /data/data/com.someapp/databases/.
Edit : Wait... I was re reading your question. Do you mean you want to access a database of another app from your own app?
Edit : If you want to access another database, the other database has to be a content provider. The best example of that is the media library (the image table above is the table that content the picture in your device). Code sample :