I have rooted phone. I want to copy data/data/com.android.providers.telephony/databases/mmssms.db file to sd card programatically.
I am getting error like java.io.FileNotFoundException: /data/data/com.android.providers.telephony/databases/mmssms.db (Permission denied)
Please help me....
Thanking you in advance...
I am using below code to copy database in sd card ' try {
File sd = Environment.getExternalStorageDirectory();
String path = Environment.getDataDirectory().getAbsolutePath();
File data = Environment.getDataDirectory();
String currentDBPath = "/data/com.android.providers.telephony/databases/mmssms.db";
String backupDBPath = "/bkup/mmssms.db";
File currentDB = new File(data, currentDBPath);
File backupDB = new File(sd, backupDBPath);
// Local database
InputStream input = new FileInputStream(currentDB);
// Path to the external backup
OutputStream output = new FileOutputStream(backupDB);
// transfer bytes from the Input File to the Output File
byte[] buffer = new byte[1024];
int length;
while ((length = input.read(buffer))>0) {
output.write(buffer, 0, length);
}
output.flush();
output.close();
input.close();
} catch (Exception e) {
// TODO: handle exception
Toast.makeText(this, e.getMessage().toString(), Toast.LENGTH_LONG).show();
}`