• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Bluetooth socket freeze phone

dhi

Lurker
Hello,

I am developing an application for Android. This app should communicate with a BT device (sending some bytes). I have a problem with debugging/running this app on my device (Samsung Galaxy mini). When I create a BT socket and stop debugging, phone freeze and I have to restart it by getting out the battery. In case of running this app (from Eclipse) everything is OK, but when I try to run it again, phone freeze and app is not installed. If I try to unninstall this app manualy before second run, phone freeze again. Here is a problematic code:

[HIGH]
private final BluetoothDevice mmDevice;
private UUID uuid;

public ConnectionThread(BluetoothDevice device) {
Log.d(TAG, "create ConnectionThread");

uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
BluetoothSocket tmp = null;
mmDevice = device;

try {
tmp = mmDevice.createRfcommSocketToServiceRecord(uuid);
} catch (IOException e) { }
mmSocket = tmp;
socketConnected = true;
}
[HIGH]

This is a constructor of thread. When I put the line tmp = mmDevice.createRfcommSocketToServiceRecord(uuid); to comments, phone doesn
 
Back
Top Bottom