On Oct 16, 2012, at 9:38 AM, Steve Sharrock <st...@sharkcode.com> wrote:
> 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 ) );

Is socketHandle IntPtr.Zero?

> 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?

What's the full stack trace that you get?

Java.Lang.Object.GetObject<T>() should return null if the handle is IntPtr.Zero.

 - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to