title: How to get list of devices and connect using BluetoothLE plugin in ionic 4?
body: <p>I'm using BluetoothLE plugin and I want to get a list of active Bluetooth devices and click to connect with the device using ionic 4. Hello, I'm using BluetoothLE plugin and I want to get a list of active Bluetooth devices and click to connect with the device using ionic 4. </p>
  
  <pre><code>....
  import { BluetoothLE } from '@ionic-native/bluetooth-le/ngx';
  import { Platform, ToastController } from '@ionic/angular';
  ....
  
  statusMessage: string;
  
  constructor(public bluetoothle: BluetoothLE,
      public platform: Platform,
      private ngZone: NgZone,
      public toastController: ToastController) {
      this.platform.ready().then((readySource) =&gt; {
  
        console.log('Platform ready from', readySource);
  
        this.bluetoothle.initialize().subscribe(ble =&gt; {
          console.log('ble', ble.status) // logs 'enabled'
        });
  
      });
    }
  
    adapterInfo() {
      this.bluetoothle.getAdapterInfo().then((success) =&gt; {
        console.log("adapterInfo: " + success);
        this.setStatus(success.name);
      })
    }
  
    startScan() {
      let params = {
        "services": [
          "180D",
          "180F"
        ],
        "allowDuplicates": true,
      }
      this.bluetoothle.startScan(params).subscribe((success) =&gt; {
        console.log("startScan: " + success);
        this.setStatus(success.address);
      }, (error) =&gt; {
        console.log("error: " + error);
        this.scanError(error);
      })
    }
  
    stopScan() {
      this.bluetoothle.stopScan().then((resp) =&gt; {
        console.log("stopScan: " + resp);
        this.setStatus(resp.status);
      })
    }
  
    retrieveConnected() {
      let params = {
        "services": [
          "180D",
          "180F"
        ]
      }
  
      this.bluetoothle.retrieveConnected(params).then((resp) =&gt; {
        console.log("retrieveConnected: " + resp);
        this.setStatus("retrieveConnected");
      })
    }
  
    // If location permission is denied, you'll end up here
    async scanError(error: string) {
      this.setStatus('Error ' + error);
      const toast = await this.toastController.create({
        message: 'Error scanning for Bluetooth low energy devices',
        position: 'middle',
        duration: 5000
      });
      toast.present();
    }
  
    setStatus(message: string) {
      console.log("message: " + message);
      this.ngZone.run(() =&gt; {
        this.statusMessage = message;
      });
    }
  </code></pre>
  
  <p>in HTML</p>
  
  <pre><code>&lt;ion-header&gt;
  &lt;ion-toolbar&gt;
      &lt;ion-title&gt;
        Ionic Blank
      &lt;/ion-title&gt;
    &lt;/ion-toolbar&gt;
  &lt;/ion-header&gt;
  
  &lt;ion-content&gt;
    &lt;ion-button (click)="adapterInfo()"&gt;AdapterInfo&lt;/ion-button&gt;
    &lt;ion-button (click)="startScan()"&gt;StartScan&lt;/ion-button&gt;
    &lt;ion-button (click)="stopScan()"&gt;StopScan&lt;/ion-button&gt;
    &lt;ion-button (click)="retrieveConnected()"&gt;RetrieveConnected&lt;/ion-button&gt;
  &lt;/ion-content&gt;
  
  &lt;ion-footer&gt;
    &lt;ion-toolbar&gt;
      &lt;p&gt;{{ statusMessage }}&lt;/p&gt;
    &lt;/ion-toolbar&gt;
  &lt;/ion-footer&gt;
  </code></pre>
  
  <p>Please Help...</p>