This is a migrated thread and some comments may be shown as answers.

ble plugin

3 Answers 62 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
kavya
Top achievements
Rank 1
kavya asked on 24 Jun 2016, 07:03 AM
hello, i am using ble.scan() function i am geting error as ble is not defined

3 Answers, 1 is accepted

Sort by
0
Garo
Telerik team
answered on 28 Jun 2016, 04:06 PM
Hello Kavya,

I was unable to reproduce the issue that you are experiencing. That being said, here are some of the possible reasons for this behavior:
  • The plugin is not included correctly to your app. If this is the case, please verify that you followed these steps to include the BLE plugin to your app.
  • You are testing the plugin in the AppBuilder Simulator. Have in mind that most of the verified plugins cannot be tested in the simulator. List of plugins supported by the simulator you could find here.
  • You are testing the plugin in the Telerik Platform Companion app. Have in mind that few of the verified plugins cannot be tested in the simulator. List of plugins supported by the Companion app you could find here.
  • A BLE method is called before the Cordova onDeviceReady event. You could access your plugin only after this event has fired. 

When you are testing plugins I would suggest deploying your app on an actual device.

I hope this helps. Please let me know if you require any further assistance.

Regards,
Garo
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Thomas
Top achievements
Rank 1
answered on 29 Mar 2017, 03:54 PM

We are seeing the same problem with error: "ble is not defined" and have done everything that you suggested. 
Still no work :(

If you verify the plugin why does it not work and make errors? 
What is the solution?
Thomas 

 

0
Kaloyan
Telerik team
answered on 31 Mar 2017, 01:51 PM
Hello Thomas,

Thank you for reporting this to us.

I made a small sample in order to check the behavior of the ble javascript object in a hybrid application and everything worked on my side. For the sake of test I did the following:
  1. I created a new hybrid application
  2. In the deviceready event, I added the following code:
    if (ble == null) {
         alert('BLE is not defined!');
    } else {
        alert('BLE is defined');
    };
    Here you can also use different checks, as: ble === "undefined"
  3. Next, I built the app as an application package and deployed in on actual device (in my case, this was an iPad).
  4. Upon starting the app on the device, I received an alert, stating "BLE is defined". This normally means that the ble object is ready and can be used in your javascript code.

The above said, can you please share some more information about the faulty behavior you are experiencing?


Regards,
Kaloyan
Telerik by Progress
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Apache Cordova
Asked by
kavya
Top achievements
Rank 1
Answers by
Garo
Telerik team
Thomas
Top achievements
Rank 1
Kaloyan
Telerik team
Share this question
or