When I send to Whatsapp
an audio that is saved in the folder raw
of my application, the file is sent but without format, that is, a file is sent without title and without the extension.
I have checked that file if I manually put the extension .mp3
I can hear it.
Code that I am using:
Intent compartiraudio = new Intent(Intent.ACTION_SEND);
Uri uri = Uri.parse("android.resource://"+getApplicationContext().getPackageName()+"/raw/audio");
compartiraudio.setType("audio/,mp3"); //el tipo es un audio
compartiraudio.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(compartiraudio, "Comparte un archivo de audio"));
This is the final result in WhatsApp
:
How can I send it as if it were an audio of WhatsApp
?