Blank page and bluetooth problem in ionic


#1

i try to connect bluetooth via Bluetooth Serial plugin so i write these codes :

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { BluetoothSerial } from '@ionic-native/bluetooth-serial';


@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
  device: Array<any>;
  isconnected: string;
  scanning:string;
  constructor(public navCtrl: NavController,public bls:BluetoothSerial) {
    this.device = [];
    this.scanning = "no scan";
  }
  scan(){ this.scanning = "scan";
    let that = this;
    this.bls.list().then(function(d){
      
      that.device = d;
      that.scanning ="success";
    },function(e){
      that.scanning = "error";
    });
  }
  checkConnect() {
    let that = this;
    this.bls.isEnabled().then(function(){
      that.isconnected = "Enable";
    },function(){
      that.isconnected = "Disable"
    })
  }

}

if i run these code in real device or in genymotion emulator with api level 17 and android 4.2.2 i get these errors :

and if i run this code on device with api 25 and android 7 i can see my app but it dosent scan bluetooth devices ? any one know what is the problem

and this is my ionic info :

ionic info

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 6.2.3
    Ionic Framework                 : ionic-angular 3.4.0

System:

    Node       : v6.11.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 4.6.1 

#2

Not supported. You can install Crosswalk to get around this, but I would think long and hard about whether you really want to do that, because (a) it’s been EOLed and (b) it will significantly bloat your app binary.

Also, arrow functions are easier to read than all of that that = this jazz.

Finally, make sure you’re waiting for the platform to be ready before attempting to interact with plugins.