0

MtpDevice.importFile(int objectHandle, String destPath) fails on 4.4 and above. Is there a way to import from an MtpDevice with the SD card write lock?

Anthony
  • 7,638
  • 3
  • 38
  • 71

1 Answers1

0

For the time being this is what I'm doing, though I'd love to avoid the double transfer:

            // KitKat and higher require the extra step of importing to the cache then moving
            if (Util.hasKitkat())
            {
                File tmp = new File(getExternalCacheDir(), name);
                mMtpDevice.importFile(objectHandle, tmp.getPath());
                success = FileUtil.moveFile(CameraImportActivity.this, tmp, endFile);
            }
            else
            {
                success = mMtpDevice.importFile(objectHandle, endFile.getPath());
            }
Anthony
  • 7,638
  • 3
  • 38
  • 71