capacitor-bluetooth-paired-devices
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Capacitor Bluetooth Serial Plugin

A client implementation for interacting with Bluetooth

Supported platforms

  • [ ] Web
  • [x] Android
  • [ ] iOS

Usage

Install the plugin via npm

npm install --save capacitor-bluetooth-paired-devices

In your capacitor project, make sure to register the Android plugin in in the projects MainActivity as follows

import com.capacitor.paired.BluetoothPairedDevices;

public class MainActivity extends BridgeActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
            add(BluetoothPairedDevices.class);
        }});
    }
}

Use from app

import {Plugins} from "@capacitor/core";

const { BluetoothPairedDevices } = Plugins;

BluetoothPairedDevices.getPairedDevices()
  .then((result: PairedDevices) => {
  /* 
   * {
   *   devices: [{
   *     name: 'device1',
   *     address: '00:00:00:00:01'
   *   }, {
   *     name: 'device2',
   *     address: '00:00:00:00:02'
   *   }]
   * }
   */
  })        

Readme

Keywords

Package Sidebar

Install

npm i capacitor-bluetooth-paired-devices

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

418 kB

Total Files

180

Last publish

Collaborators

  • lesterbx