0

I want to share mp3 file from raw folder to social apps. When I share on whatsapp, its showing fie name is document/ Untitled and file format change automatically.

    ib1.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View view) {
               Intent shareIntent = new Intent();
               shareIntent.setAction(Intent.ACTION_SEND);
               shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://com.raj.ankit.playbtntry111/" + R.raw.b1)); //myuri
               shareIntent.setType("audio/mp3");
               startActivity(Intent.createChooser(shareIntent, "Share sound"));



           }
       });
Zoe
  • 27,060
  • 21
  • 118
  • 148
Synonian_raj
  • 154
  • 1
  • 13
  • Few apps know how to handle `android.resource:`, and `EXTRA_STREAM` is not supposed to use that anyway. [`EXTRA_STREAM` is supposed to hold a `content:` `Uri`](https://developer.android.com/reference/android/content/Intent.html#EXTRA_STREAM). Copy your raw resource to a file (e.g., in `getFilesDir()`), then serve it using `FileProvider`. – CommonsWare Jun 13 '19 at 17:48
  • Will u please elaborate – Synonian_raj Jun 15 '19 at 15:23

0 Answers0