简体   繁体   中英

Write characteristic without prompt for pairing

In my Android application, I am using BLE and have a read characteristic so that devices can read data from each other with no prompt. I added a write characteristic too now, but now the user is prompted to pair the devices. Is it possible to have a write characteristic without the prompt? I don't want to bother the user with it.

When creating a Bluetooth Low Energy characteristic, there are two main things that you are in control of:-

  • Property (readable, writeable, notifiable, etc).
  • Permission (Open, encrypted, signed).

It appears that you are not setting the permission of the characteristic to open. If the characteristic that you are creating is using Android, then you can change this by:-

BluetoothGattCharacteristic.PROPERTY_WRITE
BluetoothGattCharacteristic.PERMISSION_WRITE

You can find more details about this here:-

I hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM