Chaoz
Fortgeschrittenes Mitglied
- 13
Hey leudz,
ich hab folgendes problem:
nachdem ich ein verfügbares bluetoothDevice gefunden habe und diesem device (mein Blackberrry, später soll's an n bt-drucker gehen) eine Datei schicken will, krieg ich ein "IOException: Service discovery failed". =/
Jmd ne Idee woran das liegen könnte? (ist größtenteils trivial aus android.developer.com , aber die gehen immer von nem Client/Server aus... =/ )
folgender code:
ich hab folgendes problem:
nachdem ich ein verfügbares bluetoothDevice gefunden habe und diesem device (mein Blackberrry, später soll's an n bt-drucker gehen) eine Datei schicken will, krieg ich ein "IOException: Service discovery failed". =/
Jmd ne Idee woran das liegen könnte? (ist größtenteils trivial aus android.developer.com , aber die gehen immer von nem Client/Server aus... =/ )
folgender code:
Code:
public Connector(BluetoothDevice device)
{
BluetoothSocket tmp = null;
try // Get a BluetoothSocket to connect with the given BluetoothDevice
{
tmp = device.createRfcommSocketToServiceRecord(MY_UUID); // MY_UUID is the app's UUID string, also used by the server code
}
catch (IOException e)
{
System.out.println(e.toString());
}
m_oSocket = tmp;
}
public void send()
{
// Cancel discovery because it will slow down the connection
m_oBTAdapter.cancelDiscovery();
try
{
// Connect the device through the socket. This will block
// until it succeeds or throws an exception
[B]m_oSocket.connect();[/B]
}
catch (IOException connectException)
{
try // Unable to connect; close the socket and get out
{
[B] System.out.println(connectException.toString());[/B]
m_oSocket.close();
}
catch (IOException closeException)
{
System.out.println(closeException.toString());
}
return;
}
}
}