Skip to content Skip to sidebar Skip to footer

Sharing Image From App Private Storage To Facebook

I'm attempting to take a very generic approach in providing sharing options for sharing images from my app's private storage, but I've encountered a problem that appears to be spec

Solution 1:

After much head scratching, I realized I was returning null as the MIME type. I changed the result of getType() to return "image/png", and that was it: Facebook accepted my image:

@Nullable@OverridepublicStringgetType(@NonNull Uri uri) {
    // It's absolutely imperative that we provide the MIME type, otherwise some apps like// Facebook will simply ignore the filereturn"image/png";
}

I would point out that you should return the actual MIME type of the file associated with the Uri; I'm returning PNG here because I'm lazy, and I know that all my images are of that type.

Post a Comment for "Sharing Image From App Private Storage To Facebook"