科尔多瓦-插件-蓝牙初始化方法不适用于离子

时间:2018-08-13 02:27:03

标签: ionic-framework bluetooth-lowenergy cordova-plugins phonegap-plugins

由于某些原因,initialize方法不起作用

  constructor(
    public navCtrl: NavController, 
    public platform: Platform,
    private toastCtrl: ToastController
  ) {
    platform.ready().then(
      () => {
        let initializeResult: object;
        let params: object = {
          "request": true,
          "statusReceiver": false,
          "restoreKey": "bluetoothleplugin"
        }
        console.log('Im ready3x');
        cordova.plugins.bluetoothle.initialize(initializeResult, params).then(
          (success) =>{
            this.toastInitialize('Im ready3x');
          },
          (error) =>{
            this.toastInitialize('Not ready3x');
          }
        );
        //this.toastInitialize('Im ready3x');
        let enableSuccess: object; 
        let enableError: object;
        cordova.plugins.bluetoothle.enable(enableSuccess, enableError);
        this.toastInitialize('enabled');
      }
    );

  }

可能出了什么问题?该应用程序启动,但没有看到吐司。在以前可以使用插件(离子型本机ble)扫描的真实设备上进行了测试

0 个答案:

没有答案