public ConnectWay(BluetoothHelper service) { _service = service; try { Class self = _service.ConnectedDevice.Class; Class[] paramTypes = new Class[] { Integer.Type }; Method m = self.GetMethod("createRfcommSocket", paramTypes); Java.Lang.Object[] pars = new Java.Lang.Object[] { Integer.ValueOf(1) }; mmSocket = (m.Invoke(_service.ConnectedDevice, pars) as BluetoothSocket); _service.EndDiscovery(); mmSocket.Connect(); //mmSocket = device.CreateRfcommSocketToServiceRecord(device.GetUuids().ElementAt(0).Uuid); //mmSocket = JsonConvert.DeserializeObject<BluetoothSocket>(mmDevice.Socket); _service.IsConnected = mmSocket.IsConnected; } catch (Java.IO.IOException e) { _service.IsConnected = mmSocket.IsConnected; throw new Java.IO.IOException("BluetoothHelper.ConnectWay.Constructor", e); } }