0

Before any down voting i must say that i searched community and find some answer like Create and Share a File from Internal Storage. But i can not understand answers in this topic correctly. This is my code for sharing mp3 file. But it does not send it.

Here the code:

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + ringtonepath));
sendIntent.setType("audio/*");
Utils.activity.startActivity(sendIntent);

and ringtoepath's value is /data/data/mypackagename/files/media/mysharesoundmusic.mp3. When i want to share this file using bluetooth a Toast appear with this message that file mysharesoundmusic.mp3 was not send to devicename. But when i go to media folder of application i see file in there. Before i used SD card for saving my files and using that i can share files and there is not any problem but as you know some devices has not SD card and because that i need to store files in internal Storage.

Thanks.

Community
  • 1
  • 1
karimkhan
  • 321
  • 3
  • 18

1 Answers1

2

I guess you're sending that file to another app? Is that the case. Maybe you could use FileProvider instead

http://developer.android.com/reference/android/support/v4/content/FileProvider.html

Aitor Viana
  • 933
  • 6
  • 15