Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49339

BLE scan returns [Object object] instead of any devices

$
0
0

@Qwerty10110 wrote:

im trying to use the scan function to pick up devices. everything seems to work but it doesnt return anything. ive tried it on my phone through ionic view. but still returns [object object]

the goal is the data to be displayed in the alert message.

home.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import {BLE} from '@ionic-native/ble';
import { AlertController } from 'ionic-angular';


@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  devices: any;

  constructor(public alert: AlertController, public ble: BLE, public navCtrl: NavController) { }

  showResults(){

  let notice = this.alert.create({
  title: 'devices found',
  message: this.devices,
  buttons: ['OK']
  });
  notice.present();
  }

  enable(){

  this.devices = this.ble.scan([],5);
  this.showResults();

  }
  }

any help would be appreciated :slight_smile:

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49339

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>