Android 在棉花糖中使用意图共享音频内容

Android 在棉花糖中使用意图共享音频内容,android,android-intent,android-6.0-marshmallow,Android,Android Intent,Android 6.0 Marshmallow,我正在尝试在我的应用程序中为音频文件实现内容共享功能,以下是我的代码: Intent intent = new Intent(android.content.Intent.ACTION_SEND); File file = new File(songData_new.song_path); intent.setDataAndType(Uri.fromFile(file), "audio/*");

我正在尝试在我的应用程序中为音频文件实现内容共享功能,以下是我的代码:

 Intent intent = new Intent(android.content.Intent.ACTION_SEND);
                    File file = new File(songData_new.song_path);
                    intent.setDataAndType(Uri.fromFile(file), "audio/*");
                    startActivity(intent);

但它在棉花糖设备上不起作用。有什么问题吗?

您是否添加了读取和写入外部存储运行时权限,在调用意图之前进行询问?是的,已添加