Xamarin Android and Bluetooth LE

I've been through all the discussions on this board regarding getting Bluetooth LE working with Xamarin on an Android. I've tried using MetaWear.CSharp, MetaWear.CSharp.NetStandard, Warble, etc. and have success in Windows 10 with various combinations, however have had no luck getting my Android device using a project built in Xamarin to successfully scan for a MetaWear device.

It looks like it all comes down to Xamarin not having native code to do Bluetooth LE. Other plugins are required (Warble, Aritchie - REACTIVE BluetoothLE Plugin, or others).

I'm looking for a simple project that'll scan for a BLE device (MetaWear), and then correctly communicate w/ the MetaWear device using the standard MetaWear API.

            var metawear = MbientLab.MetaWear.NetStandard.Application.GetMetaWearBoard( [ A MAC ADDRESS ] );
        catch (Exception e)
            Console.WriteLine("error: " + e.Message);

Above, I need to find the [A MAC ADDRESS] and have the backend Bluetooth LE objects in place to have the above function work.

I'm missing a piece of the puzzle that connects all this together and have gotten to the point where I'm too deep in this project to see the solution.

Can someone help with a current project built in Visual Studio 2017 using Xamarin to run a program on an Android device (7.1 or higher) that'll get me going?

We currently have a project that uses standard Bluetooth to read sensor data, we want to move to the MetaWear devices.



  • Warble and the .NET Standard plugin (which calls Warble undernath) won't work on mobile. Those are desktop only libraries.

    Unfortunately, we don't use or support Xamarin developement. Using BLE is a fairly common use case with their SDK so there is probably third party libraries to provide cross-platform BLE support.

    With that said, if you do find suitable cross platform BLE library, you can plug it into the MetaWear C# SDK in the same way the .NET Standard plugin does it.

  • Warble won't work as Eric correctly points out - however we have it working in android using Xamarin, it requires some work arounds.

    It required writing the interfaces into the SDK - "bluetoothlegatt" & "libraryio"....mentioned here https://github.com/mbientlab/MetaWear-SDK-CSharp

    We also then used a Nuget bluetooth plugin - "plugin.bluetoothle"
    Android is easier than iOS through Xamarin - as it can access the MAC address of the MetaWear, while iOS obscures and does not allow access to the MAC address, it assigns a random UUID.

Sign In or Register to comment.