Bluetooth support in Xamarin.Forms

CraigDunnCraigDunn USXamarin Team Xamurai

I've noticed a few projects attempting to tackle the issue of Bluetooth connectivity from common code in Xamarin.Forms.

At Evolve 2014 we released a beta version of the Monkey.Robotics component which contains a cross-platform Bluetooth LE abstraction that can be accessed from Xamarin.Forms apps.

The code for the entire component is open-source and includes a Xamarin.Forms app that we use to control a small netduino-powered robot.

I also have two Xamarin.Forms samples that use Bluetooth LE:

Because the component doesn't know about PCL projects, you just need to remember to reference the core robotics library yourself from the PCL. See the apps above for an example.

As mentioned above, the Bluetooth LE stack is open source and currently still under development. Consider it a beta that is still undergoing testing. We are also still working on the Windows Phone implementation of the API.

Posts

  • CraigDunnCraigDunn USXamarin Team Xamurai

    Also - if you want to try building your own robot and control it with Xamarin.Forms and Bluetooth LE - the instructions are here.

    Scott Hanselman gave it a try

    image

  • congqiangcongqiang USMember

    glad to see ble was good to go in Xamarin, How about bluetooth 2.x,3.0?

  • CraigDunnCraigDunn USXamarin Team Xamurai

    Bluetooth LE is a popular general-purpose protocol for lots of different applications.

    Bluetooth 2 and 3 are more suited to very specific uses (like external accessories such as headphones/speakers) and less useful for most app developers. There are no immediate plans to wrap those other versions in a cross-platform toolkit; although you can always access the underlying native SDKs for Bluetooth (where available) using Xamarin.

  • MarcoTMarcoT USMember ✭✭

    Hi @CraigDunn ,
    I'm using the monkey robotics library for an Ios and Android projects.

    I think that there is a bug on the Android Bluetooth low energy part.
    On both the platform I can connect to a device, read services and read?write characteristic's values.
    The problem is with notifications that on Android don't seem to work!

    I have a simple device, if I write a value in a characteristic, I can read the same value in another characteristic ( I should also receive a notification).

    On ios all work as expected. I write a value in the first characteristic and I receive a notification from the second characteristic.

    On Android, I write a value in the first characteristic but I don't receive any notification, but if i read the value from the second characteristic, i read the new value and I receive the notification.

    How can I solve this problem?

    It's seems that the development of this component is stopped. is there any chance that someone will solve this bug?

    Thank you

  • CraigDunnCraigDunn USXamarin Team Xamurai

    @Marco.8016

    the component is open-source and available on githhub.

    development has not stopped - there is a branch with Windows Phone support in progress - however like all open-source projects it depends on the availability of contributors to work on it.

    you could add an issue to the github repository, and if someone has availability they may investigate. provide as much detailed information as possible to help reproduce the error you see.

  • rogiheerogihee NLMember ✭✭✭

    Very cool! For anyone doing Bluetooth LE development, we are using the BlueRadios device for a serial port like communication with our devices.

    If anyone is stumbling on this thread, I have a C# port of their lib for Android and a binding for iOS for the library ready, so PM if you want a look. I'm too busy too clean it up and post it public, but it works just fine, but it is a bit tied in into my personal ultimate platform agnostic Device layer (coming all the way from FTDI RS232 emulator to Bluetooth 3 to Bluetooth LE ;-).

    Windows Phone support is really tied to 8.1RT but has lots of bugs and is missing a lot, so probably best to wait for 10. There is a new class for Advertisement coming, so basic 101 stuff like reading the Manufacturer data might actually gonna work this time around and you're not completely stuck after 5 minutes of starting to work on it (yes I'm being sarcastic).

  • GeorgeEdwardsGeorgeEdwards GBMember ✭✭

    I have just tried to download the Heart Rate Monitor Example, but the Robotics.mobile.core reference in the PCL is greyed out and raises an error. Please see the image below.

    image

    I also get this message int he terminal at the bottom of the screen:

    "Could not install package 'Monkey.Robotics 0.5.2'. You are trying to install this package into a project that targets 'portable-net45+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."

    Not quite sure how to resolve this, as all I can do is install the NuGet package, but then it comes under packages.

    Thanks for your help.

  • pujithaarrobothapujithaarrobotha USMember ✭✭

    I am also facing above issue.

Sign In or Register to comment.