I do this:

Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_STREAM, uriSound); sendIntent.setType("audio/*"); startActivity(Intent.createChooser(sendIntent, "Отправить:")); 

It is sent as an audio recording, not as a voice message. I tried to dig into the source code of the Android telegram client, but it never came to anything. I understood that judging by AndroidManifest.xml , LaunchActivity.java understands the intent that came, and is written to the documentsPathsArray variable. Perhaps the telegram determines the type of some flag?

  • whatsapp has a difference between an audio file and a voice message, and in Telegram how do you distinguish between the two? Any telegram audio files look the same, don't they? - McDaggen
  • @McDaggen no, otherwise I would not ask a question. Attached the screen on which you can see the difference: 1st - voice, 2nd - audio. - Tim
  • In iOS, there is such an opportunity not only in Telegram , but also in Whatsapp and Facebook . I wonder if this is possible in android? - Tim
  • @McDaggen figured out with Telegram, you need the files to be in the .ogg format of the opus codec. And how to send to whatsapp? Ogg codec opus sends as music. I recorded my vote through WhatsApp, shared a file in .opus format through a file manager - WhatsApp took it as a document. - Tim
  • With Whatsapp, everything is difficult in terms of sharing files, if I'm not mistaken, I could not really realize it. - McDaggen

1 answer 1

Files must be in the .ogg format of the opus codec.