Reputation: 21
At first I have to say, that I'm a beginner on android. I'm working on an App, which should connect to a measuring instrument without any operating elements(no Buttons, no Display) over bluetooth and receive the measured data. Unfortunately I don't know much about the measure instrument and the manufacturer as well. Everything I know is, that I have to communicate over RFCOMM and when I am pairing with android I have to send the serial number as PIN (09000). This works so far. Andorid pairs with the device. When trying to connect, it first builds up the connection and seconds later it interrupts. I'm working with a Samsung Galaxy S3 and HTC Sensation.
Here you can find my complete Bluetooth connection class:
http://iukp.chefti.com/JAVA/AndroidBluetooth.java
Here is the logcat output for more reference:
12-22 17:24:56.104: I/System.out(6079): ConnectThread()
12-22 17:24:56.104: V/BluetoothSocket.cpp(6079): initSocketNative
12-22 17:24:56.104: V/BluetoothSocket.cpp(6079): ...fd 51 created (RFCOMM, lm = 26)
12-22 17:24:56.104: V/BluetoothSocket.cpp(6079): initSocketFromFdNative
12-22 17:24:56.109: I/System.out(6079): ConnectThread() try succesfull
12-22 17:24:56.114: I/System.out(6079): ConnectThread.run()
12-22 17:24:56.114: I/System.out(6079): mmSocket.connect 0.1()
12-22 17:24:56.124: D/BluetoothUtils(6079): isSocketAllowedBySecurityPolicy start : device null
12-22 17:24:57.109: V/BluetoothSocket.cpp(6079): connectNative
12-22 17:24:57.174: V/BluetoothSocket.cpp(6079): ...connect(51, RFCOMM) = 0 (errno 115)
12-22 17:24:57.179: I/System.out(6079): true
12-22 17:24:57.184: I/System.out(6079): ConnectedThread()
12-22 17:24:57.184: I/System.out(6079): socket.X tried
12-22 17:24:57.184: I/System.out(6079): manageConnectedSocket()
12-22 17:24:57.184: I/System.out(6079): run()
12-22 17:24:57.184: I/System.out(6079): ConnectThread() try succesfull - run()
12-22 17:24:57.184: I/System.out(6079): SON F BICHT
12-22 17:24:57.184: I/Choreographer(6079): Skipped 67 frames! The application may be doing too much work on its main thread.
12-22 17:24:58.189: D/dalvikvm(6079): GC_CONCURRENT freed 91K, 6% free 12469K/13191K, paused 21ms+4ms, total 76ms
12-22 17:24:58.209: V/BluetoothSocket.cpp(6079): abortNative
12-22 17:24:58.209: V/BluetoothSocket.cpp(6079): ...asocket_abort(51) complete
12-22 17:24:58.209: V/BluetoothSocket.cpp(6079): destroyNative
12-22 17:24:58.209: V/BluetoothSocket.cpp(6079): ...asocket_destroy(51) complete
Any hint or suggestion would be greatly appreciated. Sorry for my bad English.
Upvotes: 2
Views: 6324
Reputation: 73
Since you asked this about six month ago I hope you already solved your problem but for others ending up here your problem might have something to do with this:
Android Bluetooth SPP with Galaxy S3
Check out the answeres to that question.
Upvotes: 3