Java android蓝牙文件传输失败

Java android蓝牙文件传输失败,java,android,file-transfer,android-networking,rfcomm,Java,Android,File Transfer,Android Networking,Rfcomm,在这里,我试图通过蓝牙发送一个文件,但它不发送任何数据。 这里的主要问题是,它不通过两个设备发送或接收任何数据,但它们彼此连接 发送代码: File myFile = new File(message.toURI()); Double nosofpackets = Math.ceil(((int) myFile.length() )/4096); System.out.println(nosofpackets); BufferedInputStream bis = new BufferedIn

在这里,我试图通过蓝牙发送一个文件,但它不发送任何数据。 这里的主要问题是,它不通过两个设备发送或接收任何数据,但它们彼此连接

发送代码:

File myFile = new File(message.toURI());
Double nosofpackets = Math.ceil(((int) myFile.length() )/4096);
System.out.println(nosofpackets);
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(myFile));
byte[] send = new byte[4096];
for(double i = 0; i < nosofpackets; i++)
{
    send = null ;
    a=bis.read(send, 0, send.length);
    Log.d("BluetoothChat", "data packet " + i);
    if(a == -1)
    {
        break;
    }
    mChatService.write(send);
}

您可能希望使用蓝牙在Android设备之间发送文件和其他数据(免责声明:我是作者)

您可以参考@Anu是否可以使用该代码一次发送多个用户的意图设置。。我想说的是,假设我试图一次性将同一个文件发送到4个或更多配对设备..可能吗。。?
while((bytes = mmInStream.read(buffer)) > 0)
{
    Log.d(TAG, "data is there for writing");
    bos.write(buffer);
}