I not have idea how to share the sound on messenger.
I imported api facebook but I kept going.
Forgive me for my English,
bt = (Button)findViewById(R.id.share1);
bt.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
if (ContextCompat.checkSelfPermission(MainActivity.this,
Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
String mediaPath = copyFiletoExternalStorage(R.raw.numer_1, "numer_1.mp3");
/messenger send code *.*/
} else {
requestStoragePermission();
}
}
});
2
Answers
It will launch the app which handles ACTION_SEND and you need to select messaging apps.
Ok I have an answer.
But it’s not to be a permanent answer.
I’ve been to this media types pages, where official audio types are mentionned. I didn’t see mp3 on the list.
here : https://www.iana.org/assignments/media-types/media-types.xhtml#audio
(link given by google on this page : https://developer.android.com/training/sharing/send#java)
so I converted my mp3 to aac( figuring on the page).
and finally changed :
to :
Now sending to messenger works perfectly. but still problems when sharing on whatsapp or on gmail…
But if you only aim Messenger, then here is an alternative 🙂