How to get same storage path for running android and fast boot?

97 views Asked by At

I try to make updater for my custom rom.

there is code wihch i use to flash updates

private void flashRom() throws IOException {


        Process p = Runtime.getRuntime().exec("su");
        OutputStream os = p.getOutputStream();
        os.write("mkdir -p /cache/recovery/\n".getBytes());
        os.write("echo 'boot-recovery' >/cache/recovery/command\n".getBytes());
        os.write("reboot recovery\n".getBytes());


        os.flush();
    }

And generaly it works good. My problemm occurs on some devices where /sdcard/ is refered to /mnt/media/ while getExternalStorageDir() returns /storage/emulated/0/.. for same device and i save my files with download manager to request.setDestinationInExternalPublicDir("rom", "update.zip"); Where I have to save downloaded update or how i can ensure that getExternalStorageDir() (or more apporiate method) will return same path as /sdcard/ in fastboot?

1

There are 1 answers

0
Yarh On BEST ANSWER

I used TWRP recovery instead of CWN and it recognize path properly