jeudi 29 octobre 2015

HOW TO read and write other app's database on Android

I want to read and write other app's database

I try 2 ways . both required root but still not work .

1 , copy other app's database file to my app's dir like this:

su
cat http://ift.tt/1HdP4lI > my.package/databases/data.db
chmod 660 data.db chmod 771 databases/
chown appUSR:appUSR data.db

but i use ormlite to operat it ,SQLExpetion throw "getting writable database from DBHelper fail" . I try to change the data.db's permission to 777,and after the ormlite execute and the excption throw ,the permission has been changed t 660 .Theoretically I can access this .db file whit 660.I dont konw why I can't.

2
I directly change the http://ift.tt/1HdP4lI permission to 666 and databases to 777 . still can't get access,i guess the .db file to be changed the permission when the SQLite api execute.

I delete the data.db and execute the SQLite api ,it can create a empty data.db by itself , i can handle it. But I can't access data.db copy from other app's with the same field. I change the permission,owner,group like,still not work. the two files,what's the diffrent?

NOW i copy this file to sdcard ,and i can read and write it ,but i don't want to use that way.

Aucun commentaire:

Enregistrer un commentaire