remoorejr / cordova-plugin-camera-with-exif

Cordova Camera Plugin that will return an image as well as the EXIF data (including GPS location) on iOS and Android devices.
Apache License 2.0
38 stars 53 forks source link

Android Gallery Crashes: "E/TaskPersister: File error accessing recents directory (directory doesn't exist?)" #53

Open MattSynaptic opened 4 years ago

MattSynaptic commented 4 years ago

On Android, whenever I open the device gallery select a photo from the Downloads folder, the app crashes with this message in my Android Studio log:

E/TaskPersister: File error accessing recents directory (directory doesn't exist?).

If, however, I go the same photo in the "Gallery" folder of the Gallery, it loads it fine. I'm on a Samsung Galaxy Tab A (2017) with Android 9.

MattSynaptic commented 4 years ago

I figured out a band-aide for it by adding the code below at the end of getRealPath() in FileHelper.java:

        // If the path is still null try the getPath() that is used for files
        if (realPath == null && uri != null) {
            realPath = uri.getPath();
        }

        // If null, return empty string to prevent app crashing
        return realPath != null ? realPath : "";

A proper fix should probably be included in a future release.