tengo un gran problemas, y es poder leer el archivo /data/data/com./databases/.db, el celular lo tengo con ROOT, busque en todo los foros y tengo agregado
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
Pensando que si ya tiene el permiso de administrador deberia ller todo los datos, pero no al momento de copiar me dice "Permiso denegado"
try {
File sd = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
File data = Environment.getDataDirectory();
if (sd.canWrite()) {
String currentDBPath = "/data/data/com.***/databases/***.db";
String backupDBPath = "data.db";
File currentDB = new File(currentDBPath);
File backupDB = new File(sd, backupDBPath);
if (currentDB.exists()) {
FileChannel src = new FileInputStream(currentDB).getChannel();
FileChannel dst = new FileOutputStream(backupDB).getChannel();
dst.transferFrom(src, 0, src.size());
src.close();
dst.close();
}
}
} catch (Exception e) {
System.out.println("Error : "+e.getMessage());
}
Tambien probe con comando adb:
try {
/*String fine = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)+"/msgstore.db";
Runtime.getRuntime().exec(new String[]{"su","run-as com.whatsapp cat /data/data/com.whatsapp/databases/msgstore.db"
}).waitFor();
Toast.makeText(application,"Finalizo.", Toast.LENGTH_LONG).show();*/
Runtime.getRuntime().exec(new String[]{"su","-c",
"mount -o rw,remount /system",
"chmod 777 /data/data/com.*****/databases/*.*" ,
"cp /data/data/com.*****/databases/***.db /sdcard/respaldo.db",
"mount -o ro,remount /system"
}).waitFor();
File currentDB = new File("/sdcard/respaldo.db");
if (currentDB.exists()) {
Toast.makeText(application,"El archivo existe", Toast.LENGTH_LONG).show();
}else{
Toast.makeText(application,"El archivo no existe", Toast.LENGTH_LONG).show();
}
} catch (InterruptedException e) {
Toast.makeText(application,"Error : "+e.getMessage(), Toast.LENGTH_LONG).show();
}
Y el error fue que las direcciones no existen, si existen las comprobé, alguien ayúdeme por favor