I'm aware of the reflection required to get the Socket... IntPtr createRfcommSocket = JNIEnv.GetMethodID( device.Class.Handle, "createRfcommSocket", "(I)Landroid/bluetooth/BluetoothSocket;" ); IntPtr socketHandle = JNIEnv.CallObjectMethod( device.Handle, createRfcommSocket, new JValue( 1 ) ); s = Java.Lang.Object.GetObject<BluetoothSocket>( socketHandle, JniHandleOwnership.TransferLocalRef );
I've been testing with different Barcode Scanners and RFID Readers and most of them work fine, except one scanner paired with a Galaxy Tab 2. A Google search revealed that the Galaxy Tab 2 does have some Bluetooth issues, and the recommended work-around is to use an Insecure Socket. IntPtr createInsecureRfcommSocket = JNIEnv.GetMethodID( device.Class.Handle, "createInsecureRfcommSocket", "(I)Landroid/bluetooth/BluetoothSocket;" ); IntPtr socketHandle = JNIEnv.CallObjectMethod( device.Handle, createInsecureRfcommSocket, new JValue( 1 ) ); s = Java.Lang.Object.GetObject<BluetoothSocket>( socketHandle, JniHandleOwnership.TransferLocalRef ); This doesn't work for me either and throws the NullPointerException when I try Socket.Connect(). Is my syntax correct in the Insecure code snippet? Any help is appreciated, thanks. Steve Sharrock Architecture/Design/Programming www.sharkcode.com <blocked::http://www.sharkcode.com/>
_______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid