Community

Bluetooth devices not found

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;
            }
        }

A possible cause:
When running the Rover example, during initialization I’m getting this message in the Debug output -

“D/BluetoothLeScanner(27720): could not find callback wrapper”

I found the problem.

So I deployed the application to the device and was running the debugger.

After a bit more googling the answer is: (drum roll)

Go into phone device settings → apps → (find your app) → give the app location and storage permissions.

All bluetooth servers transmitting are coming through now (TVs, computers, meadow, everything)

Did I mention how much of a pain in the ass being a newbie is?

1 Like

Thanks, my son and I just hit this problem yesterday. My guess it was permissions since nothing was showing up but didn’t have time to get back to it was presents needed to be wrapped

1 Like