private static List <BluetoothDevice> GetDevices(int type) { AndroidJavaObject array; if (type == 0) { array = ServiceClass.CallStatic <AndroidJavaObject>("u_getBondedDevices"); } else { array = ServiceClass.CallStatic <AndroidJavaObject>("u_getDiscoveredDevices"); } List <BluetoothDevice> bondedDevices = new List <BluetoothDevice>(); if (array.GetRawObject().ToInt32() != 0) { string[] devices = AndroidJNIHelper.ConvertFromJNIArray <string[]>(array.GetRawObject()); foreach (string device in devices) { string[] tokens = device.Split(','); BluetoothDevice dev; dev.address = tokens[0]; dev.name = tokens[1]; bondedDevices.Add(dev); } } return(bondedDevices); }
public static void SearchDevices() { ServiceClass.CallStatic("searchDevices"); }
public static BluetoothDevice GetDevice(string address) { return(new BluetoothDevice(ServiceClass.CallStatic <string>("getDeviceName", address), address)); }