1

someone know how to copy/save/store files from google drive url in internal storage?? I've try something like that, but doesn't work, because to store on device from google we need to read the file and make a copy in our device, otherwise google not allow to do it.Thanks in advance

enter code here


    try {
        File sd = Environment.getExternalStorageDirectory();
        if (sd.canWrite()) {
            int end = from.toString().lastIndexOf("/");
            String str1 = from.toString().substring(0, end);
            String str2 = from.toString().substring(end+1, from.length());
            File source = new File(str1, str2);
            File destination= new File(to, str2);
            if (source.exists()) {
                FileChannel src = new FileInputStream(source).getChannel();
                FileChannel dst = new FileOutputStream(destination).getChannel();
                dst.transferFrom(src, 0, src.size());
                src.close();
                dst.close();
            }
        }
        return true;
    } catch (Exception e) {
        return false;
    }
} 
Fabio Balsamo
  • 59
  • 1
  • 2
  • 11
  • Are you looking to do something like this: http://stackoverflow.com/questions/30103994/how-to-download-text-file-from-google-drive-using-the-url-by-the-google-drive-ap? – not_a_bot Jun 24 '15 at 22:27

0 Answers0