开发者

Android Copy a zip to /data/local

开发者 https://www.devze.com 2023-02-16 05:30 出处:网络
Hi I\'m working on a simple boot animation app but i\'m guessing this is a permissions problem but i\'m not really sure as i\'m new to this but anyway here is my code. I\'m trying to copy a boot anima

Hi I'm working on a simple boot animation app but i'm guessing this is a permissions problem but i'm not really sure as i'm new to this but anyway here is my code. I'm trying to copy a boot animation from the sdcard to /data/local and rename it to bootanimation.zip I know the code is fine because if i copy to another folder on the sdcard say /mnt/sdcard/folder/bootanimation.zip it works and the file is renamed but i can't copy to /data/local my phone is rooted and all but i guess my app needs to ask for su or my manifest needs more permissions. Any solutions as to why i can't copy to /data/local would be a huge help. Thank you for any help

try {
    FileChannel srcChannel = new FileInputStream("/mnt/sdcard/boots/1bootanimation.zip").getChannel();
    FileChannel dstCh开发者_StackOverflowannel = new FileOutputStream("/data/local/bootanimation.zip").getChannel();
    dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
    srcChannel.close();
    dstChannel.close();
    } catch (IOException e) {
                    }


Problem actually wasn't mounting data, as that mounts automatically like i thought problem was the permissions on the /data/local my app didn't have permission to write to the folder once i chmod the folder it works perfectly

0

精彩评论

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