调用原生系统的文件分享中的蓝牙分享功能
//调用android分享窗口
Intent intent2 = new Intent(Intent.ACTION_SEND);
intent2.setType("*/*");
intent2.setPackage("com.android.bluetooth");
intent2.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(Environment.getExternalStorageDirectory().getPath() + "//" + "盘点导入//" + fileName)));//path为文件的路径
intent2.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//7.0以上可能会报错 java.lang.SecurityException: Permission Denial
//使用这一段即可
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
builder.detectFileUriExposure();
Intent chooser = Intent.createChooser(intent2, "Share app");
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(Intent.createChooser(chooser, "分享"));