Android 使用Intent.ACTION\u SEND的文件共享在BBM上拒绝访问

Android 使用Intent.ACTION\u SEND的文件共享在BBM上拒绝访问,android,android-permissions,bb-messenger,Android,Android Permissions,Bb Messenger,我正在尝试共享应用程序保存的音频文件。该文件已添加到媒体商店,因此所有应用程序都可以访问该文件 Intent mediaScannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri fileContentUri = Uri.fromFile(finalFile); mediaScannerIntent.setData(fileContentUri); this.sendBroadcast(me

我正在尝试共享应用程序保存的音频文件。该文件已添加到媒体商店,因此所有应用程序都可以访问该文件

Intent mediaScannerIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
    Uri fileContentUri = Uri.fromFile(finalFile);
    mediaScannerIntent.setData(fileContentUri);
    this.sendBroadcast(mediaScannerIntent);
我使用Intent.ACTION\u SEND将文件共享给其他应用程序:

public void shareRecording(View view) {
    Intent i = new Intent(Intent.ACTION_SEND);
    i.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    i.setType("audio/mp3");
    i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///" + recording.getFilePath()));
    try {
        startActivity(Intent.createChooser(i, "Share " + recording.getName()));
    } catch (android.content.ActivityNotFoundException ex) {
        Toast.makeText(this, "There are no app installed to share your audio file.", Toast.LENGTH_SHORT).show();
    }
}
所有的应用程序都能很好的工作,比如GMail,Yahoo mail,Whatsapp。。。 除BBM外,它拒绝访问。 我需要做什么才能让它在BBM上工作

谢谢你的帮助

更新:

我曾经

Uri fileUri = Uri.parse("content://" + recording.getFilePath());
而不是

Uri fileUri = Uri.parse("file:///" + recording.getFilePath());
它在BBM上有效,但在其他应用上无效

那么,用“file://”和“content://”解析的URI之间有什么区别呢? 我怎样才能用它来让所有应用程序的共享工作


解决方案是使用实际文件初始化Uri对象

File recordingFile = new File(recording.getFilePath());
Uri fileUri = Uri.fromFile(recordingFile);
这适用于所有可以共享文件的应用程序