哪种方式更好的共享视频文件?
1.使用MediaScannerConnection -
MediaScannerConnection.scanFile(context, new String[] { selectedVideoShare },
null, new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
Intent shareIntent = new Intent(
Intent.ACTION_SEND);
shareIntent.setType("video/*");
shareIntent.putExtra("VSMP", "https://play.google.com/store/apps/details?id=" + context.getPackageName());
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
context.startActivity(Intent.createChooser(shareIntent,
context.getString(R.string.share_text)));
}
});
2.使用文件提供程序 -
https://infinum.co/the-capsized-eight/share-files-using-fileprovider