Ionic wrapper for cordova ble plugin not designed correctly

I have been using the BLE Cordova plugin for many years. I have noticed that occasionally more so on iOS than Android that once I start notifications and send a message down, I never get the notification back. I added an issue in the repository:

Don mentioned the following in regard to the ionic wrappers:

The Ionic wrappers automatically calling stopNotification can cause problems. This plugin was designed with callback, many of which can call success and error multiple times. This doesn't work well with Observables since the first error destroys the subscription.

Due to this I would like to use just the BLE Cordova plugin without the ionic wrapper.

Can someone explain to me how to use a Cordova plugin without the ionic wrapper?


Dont install the ionic wrapper, just the plugin.

How then do you inject it into a component?

use (<any>window).plugins.bel.startScan()

Thanks for the reply.

I have the following in a page:

  scan() {

does anything need to be injected into the page to call the plugin this way?

As I currently have it I get the following error:

HomePage.html:11 ERROR TypeError: Cannot read property 'ble' of undefined

I found this on stackoverflow:

I had to declare the following at the top of my home component and was able to use it at that point.

declare var ble: any;