I'm trying to open a file in an external PDF viewer (by long-pressing "Read Article") on two Android devices without much success. Both devices are running Mendeley 1.14.1, and Mendeley and the external readers have the appropriate Android storage permissions. I'm experiencing two distinct failure modes.
1. Lollipop 5.1.1 (Samsung Galaxy Core Prime, Library on external SD card)
Long-pressing immediately gives an "Unfortunately, Mendeley has stopped" error. I have no other useful information here.
2. Marshmallow 6.0.1 (ZTE Trek 2 HD K88, Library on internal storage)
Long-pressing gives the menu for selecting an application, but opening fails. I've tried it with:
Aldiko - "Import failed" with a detailed message I give below.
Amazon Kindle - "Permission denied"
Bookari Free - "Download failed."
Dropbox PDF Viewer - "Can't open file."
Google PDF Viewer - A blank page.
Moon+ Reader - App opens the default directory of its built-in file browser.
MuPDF - Blank message with "Dismiss" button.
Google Drive PDF Viewer - It works! (Quite unexpectedly, since Google PDF Viewer is the same viewer w/o Google Drive functionality.) And I can then open the file in any of the above readers with this app's "Open with" feature. It's an inelegant workaround, but better than nothing.
Now, Aldiko prints a fairly informative exception that may point to the root issue, at least in Marshmallow.
"Import failed [Permission Denial: opening provider android.support.v4.content.FileProvider from ProcessRecord{b81ed4b17086:com.aldiko.android/u0a138} (pid=17086, uid=10138) that is not exported from uid 10105]"
Here (pid=17086, uid=10138) is Aldiko and (uid=10105) is Mendeley.
This seems to indicate that Mendeley is not using grantUriPermission and revokeUriPermission when invoking FileProvider, as outlined in an article (https://medium.com/@a1cooke/using-v4-support-library-fileprovider-and-camera-intent-a45f76879d61) where a working pattern for a similar use case is given. Hopefully the devs can spare the time to see if the above is a plausible solution to this frustrating problem.
Otherwise treating Google Drive PDF Viewer as an intermediary is a working stopgap for me, and perhaps other users will find the same.
↧