android 调用系统的蓝牙分享文件

有时我们需要调用系统的蓝牙分享文件,代码如下:

 //调用android分享窗口
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("*/*");
intent.setPackage("com.android.bluetooth");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path)));//path为文件的路径
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent chooser = Intent.createChooser(intent, "Share app");
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(chooser);

猜你喜欢

转载自blog.csdn.net/qq_32072451/article/details/80018871