Android Bluetooth file sending
===

I am trying to send a file over bluetooth in an android device. I have done discovery, connection and have made a bluetooth socket. Problem is when i am writing the byte array in the output stream of the bluetooth socket, the recieving side does not receive anything although it accept that something is being sent.

Here's what  Iam doing (bad is the bluetooth adaptor)

Please advise.
    
    try
		{
			BluetoothDevice dev = bad.getRemoteDevice(a);
			bad.cancelDiscovery();
			
			dev.createRfcommSocketToServiceRecord(new UUID(1111, 2222));
			Method m = dev.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
            bs = (BluetoothSocket) m.invoke(dev, Integer.valueOf(1));
            bs.connect();
            tmpOut = bs.getOutputStream();
		}catch(Exception e)
		{
			
		}
		
		File f = new File(filename);
		
		byte b[] = new byte[(int) f.length()];
		try
		{
			FileInputStream fileInputStream = new FileInputStream(f);
			fileInputStream.read(b);
		}catch(IOException e)
		{
			Log.d(TAG, "Error converting file");
			Log.d(TAG, e.getMessage());
		}
		
		try {
			tmpOut.write(b);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}