Bluetooth経由でプリンターに接続し、テキストを印刷するアプリケーションに取り組んでいます。Bluetoothでプリンターに接続し、BluetoothSocketからoutputStreamを取得してテキストを書き込むことができます。しかし、プリンターには何も印刷されません... 注意深く確認しましたが、例外はありません。私のコードで何が間違っていたのか助けてください???`私はCanon MX430プリンターをテストに使用しました..これが私のコードです
String MY_PRINTER_MAC_ADDRESS="00:12:FF:67:89";// Printer Mac Address
private UUID applicationUUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
String test="testing123234123";
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothDevice = mBluetoothAdapter.getRemoteDevice(mDeviceAddress);
mBluetoothSocket = mBluetoothDevice.createRfcommSocketToServiceRecord(applicationUUID);
Method m = mBluetoothDevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
mBluetoothSocket = (BluetoothSocket) m.invoke(mBluetoothDevice, 1);
mBluetoothAdapter.cancelDiscovery();
mBluetoothSocket.connect();
OutputStream os=MainActivity.mBluetoothSocket.getOutputStream();
byte[] buffer=test.getBytes();
os.write(buffer);
os.flush();
os.close();`