I’m using JNI to get a IntPtr to a bluetooth connection method. The code is:
IntPtr createRfcommSocket = JNIEnv.GetMethodID(device.Class.Handle, "createRfcommSocket", "(I)Landroid/bluetooth/BluetoothSocket;");
IntPtr socket = JNIEnv.CallObjectMethod(device.Handle, createRfcommSocket, new JValue(1));
Is there anyway to convert the IntPtr socket to a native monodroid BlueToothSocket?
I need this to offer a single interface to a create bluetooth socket method.
If by “native monodroid BlueToothSocket” you mean BluetoothSocket, then you use the Java.Lang.Object.GetObject<T>() method: