开发者

How could i access to contacts db and change it in android?

开发者 https://www.devze.com 2023-03-31 11:54 出处:网络
I want to access to this path on android. /data/data开发者_开发百科/com.android.providers.contacts/databases/contacts2.db

I want to access to this path on android.

/data/data开发者_开发百科/com.android.providers.contacts/databases/contacts2.db

but i could not.i think because it s private.but i want to backup it and will restore it.

my phone in root.but i could not do that too.

what should i do?

thanks and regards


I don't think the database was meant to be accessed directly. Have you looked at the Content Providers?


finally i found a way.

first your phone should be root!

and second step is to change contacts2.db permissions. for that use below codes :

        Process p;   
    p = Runtime.getRuntime().exec("su");
    p = Runtime.getRuntime().exec("chown root.root /data/data/com.android.providers.contacts/databases/contacts2.db");
    p = Runtime.getRuntime().exec("chmod 777 /data/data/com.android.providers.contacts/databases/contacts2.db");

and after that you can access to it!

0

精彩评论

暂无评论...
验证码 换一张
取 消