Can't share audio with Facebook Messenger on Android: "Sorry, Messenger was unable to process this file"
Solution 1
I found out that Facebook Messenger doesn't accept filenames that contain spaces on them, this means you can't share an audio file named "audio test.mp3", but it will work fine if it is named "audio_test.mp3"
It also won't accept non-ASCII characters (á,ó,ñ,ç, etc)
Solution 2
I was facing this problem from long time, What i did actually was putting these 2 line of code, and now it can work for any file format and of any file name.
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(pathToFile)));
Thanks to @csbubbles for his comment.
csbubbles
Updated on July 09, 2022Comments
-
csbubbles almost 2 years
I am using the following piece of code to share an audio file located on a device:
Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://pathToFile")); intent.setType("audio/*"); activity.startActivity(Intent.createChooser(intent, "Share..."));
Android opens the system Share dialog where you can select an appropriate app to handle the share intent. Audio files get successfully shared with Gmail, WhatsApp, Telegram and Google Drive.
But Messenger shows the following error:
However, when I try to share the same file using Android's Download app, it all works just fine with Messenger.
Why does Messenger not process my share request correctly, while all the other apps do, and what needs to be changed in my code so it would work the same way as sharing from the Download app (so it would work for Messenger)?
-
csbubbles about 7 yearsThat's right. I eventually changed this:
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://pathToFile"));
to this:intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(pathToFile)));
and it all started working in all the cases. It looks like Facebook app has a bug, and it doesn't process URLs correctly. So it matters how you create it.