vendredi 26 février 2016

is it possible to copy a sqlite database to another location

the device is not rooted. I am getting the following error when i try to copy the db:

java.io.FileNotFoundException (Permission denied)

I have the correct permissions:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

here is my code:

source = new FileInputStream(currentDB).getChannel();
destination = new FileOutputStream(backupDB).getChannel();
destination.transferFrom(source, 0, source.size());
source.close();
destination.close();

is this even possible if the phone is not rooted?

Aucun commentaire:

Enregistrer un commentaire