Data transfer BLE Xamarin Forms

Hi everyone. I am new to BLE and I hope that any of you can guide me through what I want to solve. I want to send data via BLE but without pairing with any device. More specific, I want to open a door via Bluetooth LE but I do not want to pair with the door lock in order to lock or unlock the door. Has anyone done something like this or can any of you guide me on how can I solve this ? (Xamarin Forms - Android)



  • LandLuLandLu Member, Xamarin Team Xamurai

    What you described above seems that you wanted to advertise data through BLE.
    This plugin could help you:
    Use this to advertise:

    CrossBleAdapter.Current.Advertiser.Start(new AdvertisementData
        LocalName = "TestServer",
        ServiceUUIDs = new Guid[] { /* your custom UUIDs here */ }

    Moreover, you could refer to the advertising documentation:

  • calincozmincalincozmin Member ✭✭

    @LandLu I just tried with their last version and it's not working as it should.

    After a couple of failures I did something like the code below. It's working but only with data smaller than 31 bytes. There is any possibility to increase the limit of data ?


    ` AdvertiseSettings settings = new AdvertiseSettings.Builder()

                            ParcelUuid pUuid = new ParcelUuid(UUID.FromString(UuiD));
                            AdvertiseData data = new AdvertiseData.Builder()
                                .AddServiceUuid(pUuid )
                                .AddServiceData(pUuid , bytes)
                                .Build(); //.SetIncludeDeviceName(true)
                            _manager.Adapter.BluetoothLeAdvertiser.StartAdvertising(settings, data, new AdvertiseCallBackClass());`
Sign In or Register to comment.