1

I have an activity that can receive intents with ACTION_VIEW, and "application/octet-stream" mime types. when I receive a file from "Google Drive" android app, Uri is in Intent Extra's getParcelableExtra() and every thing works fine.

Uri returnUri = getIntent().getParcelableExtra(Intent.EXTRA_STREAM);
if (returnUri == null)
    returnUri = getIntent().getData();
ParcelFileDescriptor mInputPFD;
try {
// Get the content resolver instance for this context, and use
// it to get a ParcelFileDescriptor for the file.
   mInputPFD = getContentResolver().openFileDescriptor(uri, "r"); //Line:87 (Exception here)
}
catch (FileNotFoundException e)
{
     e.printStackTrace();
     Log.e("MainActivity", "File not found.");
     return false;
}
// Get a regular file descriptor for the file
FileDescriptor fd = mInputPFD.getFileDescriptor();

But when I receive an Intent from "OneDrive" android app, Uri is in getData() and when I try to obtain a ParcelFileDescriptor from Uri, I receive an exception:

java.io.FileNotFoundException: Not a whole file

at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:542)
at <one of my classes>(<class name>.java:87)

EDIT: I am choosing same files for both Google Drive and OneDrive

user2136334
  • 648
  • 7
  • 16

0 Answers0