public override void OnReceive(Context context, Intent intent) { string action = intent.Action; // When discovery finds a device if (action == BluetoothDevice.ActionFound) { // Get the BluetoothDevice object from the Intent BluetoothDevice device = (BluetoothDevice)intent.GetParcelableExtra(BluetoothDevice.ExtraDevice); Console.WriteLine(String.Format("Bluetooth Device: {0}", device.Name)); if(_location == null) { throw new NullReferenceException("Location in the Reciever is NULL"); } BTSearchResult result = new BTSearchResult(_location); //fill out result. _results.Add(result); // If it's already paired, skip it, because it's been listed already if (device.BondState != Bond.Bonded) { } // When discovery is finished, change the Activity title } }
private List<BTSearchResult> getCurrentPairedDevices() { var currentPairings = _bluetooth.BondedDevices; List<BTSearchResult> results = new List<BTSearchResult>(); foreach(var pairing in currentPairings) { BTSearchResult result = new BTSearchResult(_location); //fillout object here results.Add(result); } return results; }