I'm currently building a c# windows app that has a requirement of emptying out the sms inbox from an android devices.
I'm using RegawMOD.android lib to create and execute adb
commands.
The first thought was to delete mmssms.db
and reboot the device which works.
However, rebooting the device takes a lot of time.
so I took another approach :
I copied the DB to the internal SD card
pulled it to my pc
accessed it with sqlite
(through code) and emptied the SMS table.
copied it back to internal SD card.
The problem is with copying it back to /data/data/com.android.providers.telephony/databases/
When I try to run it inside the code, I get permission denied even though I run it with shell and su
settings. If I run the same code in adb shell
on a command line prompt, it works perfectly.
this is the code :
AdbCommand MoveToData = Adb.FormAdbShellCommand(device, true, "cat", "/storage/sdcard0/download/mmssms.db > /data/data/com.android.providers.telephony/databases/mmssms.db");
In your su 0 cat /storage/sdcard0/download/mmssms.db > /data/data/com.android.providers.telephony/databases/mmssms.db
command only the part before the redirection runs with root
privileges. The redirection is still being run with your app's user ID.