Ok, so I have a bluetooth.java class which (i'd hoped) would send my strings.. however whenever I try to send the command my broken toasts just show saying nope. Am I missing something vital? I only have these 2 functions in there..
void openBT() throws IOException {
UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805f9b34fb");
try {
mmSocket = mmDevice.createRfcommSocketToServiceRecord(uuid);
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "Unable to create socket", Toast.LENGTH_LONG).show();
}
try {
mmSocket.connect();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "Unable to connect to socket", Toast.LENGTH_LONG).show();
}
mmOutputStream = mmSocket.getOutputStream();
mmInputStream = mmSocket.getInputStream();
}
void sendData2() throws IOException {
if (BtCommand == "0"){
msg = "Fan2 Off";
}
if (BtCommand == "1"){
msg = "Fan2 On";
}
mmOutputStream.write(msg.getBytes());
}
and these are the only things I set
BluetoothSocket mmSocket;
BluetoothDevice mmDevice;
String BtCommand;
OutputStream mmOutputStream;
InputStream mmInputStream
I am sure it is the openBT function which is failing, I am paired to a device fine.