Community
cancel
Showing results for 
Search instead for 
Did you mean: 
abdul_k_
Beginner
301 Views

Cordova BLE - evothings.ble not defined (Try to convert Evothing App to INTEL XDK App)

 I have run an Eddystone Scan in my mobile evo viewer, its works fine. But i try convert it to an app using INTEL XDK , evothings scan not supported. I have installed the separate plugins (cordova-plugin-eddystone , cordova-plugin-ble which is inbuilt in eddystone plugin ) and also tried inbuild js method also. But scan not working.

I have checked evothings object is defined or not, 

if (evothings) { console.log('evothings is defined') } 
else { console.log('evothings not defined') } 

if (evothings.ble) { console.log('evothings.ble is defined') } 
else { console.log('evothings.ble not defined') } 

if (evothings.eddystone) { console.log('evothings.eddystone is defined') } 
else { console.log('evothings.eddystone not defined') } 

In my console returns 'evothings.ble not defined' , "Uncaught TypeError: Cannot read property 'stopScan' of undefined " that line number is 853 on eddystone.dist.js file.

evothings.ble.stopScan();

evothings.ble.startScan(serviceUUIDs, onDeviceFound, onError);

In evothings.ble.startScan and evothings.ble.stopScan is not working. Kindly explain how to proceed it further.

 

Tags (2)
0 Kudos
10 Replies
PaulF_IntelCorp
Employee
301 Views

Where are you checking for the presence of these plugin APIs? They will not show up in the Simulate tab and they will not show up in App Preview. They will only work on Android from the Debug tab or within a built app.

Please read this doc page > https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview <

abdul_k_
Beginner
301 Views

I have built apk and tested in my mobile device (Sumsung S5 and Smartphone A8 model) 

PaulF_IntelCorp
Employee
301 Views

Abdul -- make a new project based on the "hello cordova" sample app and add those two plugins to the app and build an APK. Then run that APK on your two devices. Scroll to the bottom of the app's screen and scroll within the "text area" below the "license terms and conditions" link. Then scroll within that text box until you find a list of plugins that are part of the app, similar to what you see in the screenshot below. If you see the plugins you added to this sample they will show up in the list (they are not part of the list I'm showing below because this is a build of the standard sample).

Screenshot_2016-08-18-10-07-55.png

 

abdul_k_
Beginner
301 Views

 

Hi Paul,

I have built sample app "hello cordova" and also install those two plugin. When i run apk in my mobile, Evothings Cordova BLE ( https://github.com/evothings/cordova-ble ) not diplayed in plugin list. 

Mikael_K_
Beginner
301 Views

Hi, I am one of the maintainers of the plugin in question (https://github.com/evothings/cordova-ble).

Are there any special requirements for plugins for Intel XDK? (Sorry, I have not used Intel XDK myself). Any hints towards make the plugin working would be appreciated.

Best regards, Mikael Kindborg

PaulF_IntelCorp
Employee
301 Views

Mikael -- the only restriction we have, in our current build system, is we do not execute plugin gradle scripts. We hope to remove that restriction in a future release of the build system. However, I don't see any gradle scripts in your plugin that would cause a problem. Other than that restriction, the Intel XDK builds standard Cordova apps.

Abdul -- perhaps you are using the wrong technique or an older version of the XDK? This plugin requires Cordova CLI > 6.0, which means you'll have to use 3491 or later to install it into your project (because 3400 and older uses Cordova CLI 5.x to "install" the plugins into your project). Likewise, you need to insure you're building with CLI 6.2.0 in the Build Settings. I just did the test I outlined in a previous post and I can see that the plugin is present in my app. Likewise, and "evothings" object shows up in my JavaScript namespace, which I believe is where this plugin's API is accessed (at least according to the example). I see the README says you should add some JS lib files to access this at a higher level, I haven't tried that, but I'm pretty confident that will work, as well. BTW -- you do not add those JS lib files as plugins, those are just simple JavaScript library files that you add using a <script> tag in your index.hmtl file. I recommend you add them AFTER the cordova.js script tag, not before. See the comments at the bottom of the "hello cordova" index.html file for the recommended order of JS scripts in your app. Those add-on BLE JS libs are "device-dependent" JS libraries, not "device-independent" JS libraries.

Some pictures might help:

Screen Shot 2016-08-19 at 9.20.12 AM.png

Screen Shot 2016-08-19 at 9.21.00 AM.png

Screen Shot 2016-08-19 at 9.21.24 AM.png

In the Simulate tab:

Screen Shot 2016-08-19 at 9.19.40 AM.png

from the Simulate debug console:

Screen Shot 2016-08-19 at 9.28.46 AM.png

From a built app on a real device:

Screenshot_2016-08-19-09-17-59.png

 

abdul_k_
Beginner
301 Views

Hi Paul,

Thank you for your response, now ble plugin works fine.

SSBC
Beginner
301 Views

I'm also interested in this same Evothings BLE plugin.

That in mind, I've been able to successfully add this plugin to the project and get it to show up in Hello, Cordova app as Paul illustrated above, but only in simulation. If I run the app via the Test & App Preview, this specific plugin does not show up.

Is this expected behavior for 3rd-party plugins?

 

Thanks!

-ssbc

PaulF_IntelCorp
Employee
301 Views

SSBC -- please see these doc pages regarding App Preview and the Test tab:

Especially the highlighted paragraph under the "Purpose" section.

SSBC
Beginner
301 Views

Thanks for clarifying, Paul!

Reply