简体   繁体   中英

Change BLE device name using cordova-ble-plugin

I am using corodova-ble-plugin ( https://github.com/don/cordova-plugin-ble-central ) with my ionic 4 project and I wanted to know if its possible to change the bluetooth device name with this plugin. I searched the ble plugin documentation and did not find anything. But have anyone done such thing with an ionic app before without native android dev?

** Update **

I was able to find the characteristics that has to be passed using the write method to set the name of the device. But the passed value has to be a array buffer type and not string. So I used the string to array buffer npm package, its passing the write value when I checked in the android studio console but in the device it shows up with symbols instead and not the actual name. What would be going wrong here?

I'm not an expert in Cordova but it looks like this plugin doesn't allow what you're looking for. The good news is if you change the name of the device using native code, it should work.

BluetoothAdapter.getDefaultAdapter().setName("myDeviceName");

You can use that in your MainActivity.

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