Scenario
- Currently developing Xamarin phone app to talk to meadow BLE.
- Using Meadow sample bluetooth apps for examples
- BLE is running on meadow and can be found during bluetooth scan with phone
- Meadow application is running and can be debugged in VS2019
- Xamarin App is being deployed to Android device and I can debug in VS2019
When deploying my apps and meadow sample apps, the BT device list (DeviceList) is not populating. In fact, it appears the “adapter.DeviceDiscovered” event is not being triggered, thus the DeviceList is never popluated.
So far I’ve deployed the example apps and none of them work either:
- MobileBle
- Rover
Any ideas?
public BaseViewModel()
{
DeviceList = new ObservableCollection<IDevice>();
adapter = CrossBluetoothLE.Current.Adapter;
adapter.ScanTimeout = listenTimeout;
adapter.ScanMode = ScanMode.LowLatency;
adapter.DeviceDiscovered += AdapterDeviceDiscovered;
async void AdapterDeviceDiscovered(object sender, DeviceEventArgs e)
{
if (DeviceList.FirstOrDefault(x => x.Name == e.Device.Name) == null &&
!string.IsNullOrEmpty(e.Device.Name))
{
DeviceList.Add(e.Device);
}
if (e.Device.Name == "JCDV")
{
await adapter.StopScanningForDevicesAsync();
IsDeviceListEmpty = false;
DeviceSelected = e.Device;
}
}