Ionic 2 bluetooth serial problem

hello
i installed bluetooth serial cordova plug in my project
but when i write

BluetoothSerial.isEnabled(
    function() {
        console.log("Bluetooth is enabled");
    },
    function() {
        console.log("Bluetooth is *not* enabled");
    }
);

isEnabled give following error
"Property ‘isEnabled’ does not exist on type ‘typeof BluetoothSerial’. "

i used following commands to install plug as documentation said

$ ionic plugin add cordova-plugin-bluetooth-serial
$ npm install --save @ionic-native/bluetooth-serial

https://ionicframework.com/docs/native/#Add_Plugins_to_Your_App_Module maybe?

1 Like

You are using pre-ionic-native-v3 syntax, yet installing ionic-native v3 shims. As of native-v3, you no longer call any methods on plugin types, as the compiler is politely telling you. Instead, you inject an object of type BluetoothSerial in your constructor and call methods on it instead.

2 Likes