I am compiling for SDK 10 (2.3.3):
android:minSdkVersion="10"
android:targetSdkVersion="16"
I am testing on two Sony Ericsson smartphones. One has Android 2.3.7 on it and the other 4.0.1.
I am using listenUsingInsecureRfcommWithServiceRecord to open a new server socket on bluetooth and listen to connections.
If the connection is accepted successfully then everything works fine. I can even try to cancel the server socket but that does not seem to bother the connection socket just created.
BUT when I want to cancel the server socket before having accepted any connections as soon as the line bluetoothServerSocket.close(); gets executed the entire activity closes and the process dies. And furthermore this is not a regular exception which I could handle.
Actually even logcat itself quits!! and I have to quickly execute it again in order to grab the errors you can see below:
Zygote D Process 25471 terminated by signal (11)
295 InputDispatcher W channel '2c2e20a8 com.pligor.test/activities.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
295 InputDispatcher E channel '2c2e20a8 com.pligor.test/activities.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
295 dalvikvm D GC_FOR_ALLOC freed 1299K, 21% free 13252K/16583K, paused 93ms
295 InputDispatcher W Attempted to unregister already unregistered input channel '2c2e20a8 com.pligor.test/activities.MainActivity (server)'
295 BluetoothService D Tracked app 25471 diedType:10
295 BluetoothService D Removing service record 10009 for pid 25471
132 SurfaceFlinger D Release buffer at 0x61c08
295 WindowManager I WINDOW DIED Window{2c2e20a8 com.pligor.test/activities.MainActivity paused=false}
295 ActivityManager I Process com.