Bluetooth Serial
This plugin enables serial communication over Bluetooth. It was written for communicating between Android or iOS and an Arduino (not Android to Android or iOS to iOS).
https://github.com/don/BluetoothSerial
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation#
- Capacitor
- Cordova
- Enterprise
$ npm install cordova-plugin-bluetooth-serial $ npm install @ionic-native/bluetooth-serial $ ionic cap sync
$ ionic cordova plugin add cordova-plugin-bluetooth-serial $ npm install @ionic-native/bluetooth-serial
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
#
Supported Platforms- Android
- iOS
- Windows Phone 8
#
Usage#
ReactLearn more about using Ionic Native components in React
#
Angularimport { BluetoothSerial } from '@ionic-native/bluetooth-serial/ngx';
constructor(private bluetoothSerial: BluetoothSerial) { }
// Write a stringthis.bluetoothSerial.write('hello world').then(success, failure);
// Array of int or bytesthis.bluetoothSerial.write([186, 220, 222]).then(success, failure);
// Typed Arrayvar data = new Uint8Array(4);data[0] = 0x41;data[1] = 0x42;data[2] = 0x43;data[3] = 0x44;this.bluetoothSerial.write(data).then(success, failure);
// Array Bufferthis.bluetoothSerial.write(data.buffer).then(success, failure);