cordova-plugin-bluetoothle icon indicating copy to clipboard operation
cordova-plugin-bluetoothle copied to clipboard

Bluetoothle is not defined

Open Trauck opened this issue 7 years ago • 5 comments

Hi, I added this plugin to connect in bluetooth to a device. So I ran the installation "cordova plugin add cordova-plugin-bluetoothle", then I try to use it in my javascript related to my html page. But when I build on my device, nothing happens like when there is a js error. Here but version of android and cordova: android 6.4.0, cordova 8.0.0. I call bluetoothle like this in my scripts: image

I have already try to remove and re add the plugin, nothing works, i watch other issues but no ones help me. I can see the plugin is added in my cordova_plugins.js, cordova.js and my config.xml. I think the problem comes from the way I call bluetoothle in my script.

Trauck avatar May 03 '18 10:05 Trauck

You're probably calling plugin code before the plugin is actually ready. Are you waiting for the cordova ready event?

randdusing avatar May 03 '18 13:05 randdusing

Yes sure, i make the same thing with "$(document).ready(function(){ ... ".

Trauck avatar May 04 '18 14:05 Trauck

That's when jquery is safe to use, not cordova plugins. I forgot the event name off the top of my head, but check out the example in the Angular wrapper

randdusing avatar May 05 '18 15:05 randdusing

It's good, finally everything worked very well I forgot the addition of a script (cordova.js).

I still have a new question. When I press a button on my application I launch my bluetooth connection, my bluetooth is activated very well, but then I would like to show the list of possible connections. How to do this ? I try with the Scan but when I run it, nothing appears.

And what is the function that turns off the bluetooth of the phone?

Trauck avatar May 14 '18 13:05 Trauck

It's good, finally everything worked very well I forgot the addition of a script (cordova.js).

I still have a new question. When I press a button on my application I launch my bluetooth connection, my bluetooth is activated very well, but then I would like to show the list of possible connections. How to do this ? I try with the Scan but when I run it, nothing appears.

And what is the function that turns off the bluetooth of the phone?

HI Trauck , I face to same issue , can you show me how you addition of a script (cordova.js)? Thanks so much

DonOzOn avatar Apr 16 '22 03:04 DonOzOn