Page 1 of 1

Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Posted: 16:14, 15 Jul 2015
by cavalcantejean
Hello everyone,
I am new to evothings but I used the BLE Scan example to make an android app with cordova to activate the bluetooth and list the active devices. But when I click on "Start Scan". It shows me the following message in the android logcat on Eclipse:
Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Posted: 15:13, 21 Jul 2015
by Fredrik
I suspect that the BLE plugin is missing. Add it by running this command:

cordova plugin add https://github.com/evothings/cordova-ble

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Posted: 08:37, 19 Sep 2015
by abstractUser
Hello:

I'm encountering a similar problem. I've installed the ble plugin.

To summarize the problem.
1. The app runs perfectly well when run from the Evothings client app.
2. The cordova built app works otherwise fine but for the functionality when a bluetooth connection is requested.
3. When a connection is requested, evothings.rfduinoble.close() is called, which in turn calls evothings.easyble.stopScan(), which in turn calls evothings.ble.stopScan().
4. Where is this last function i.e, evothings.ble.stopScan(), as the error occurs at this stage.
5. ble.js that comes with the plugin does not have the definition of this function.

So perhaps, we are missing something.

Thank you.

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Posted: 12:53, 22 Sep 2015
by Fredrik
ble.js contains "exports.stopScan". The "exports" part gets converted by cordova to "evothings.ble".

Let's check if you added the plugin properly. Run "dir plugins" (or "ls plugins" on mac/linux) and post the output.

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Posted: 14:11, 19 Nov 2015
by josephclawrence
I think I'm having exactly the same issue on iOS, covered in a new thread here, if anyone comes here (not solved yet): viewtopic.php?f=8&t=1847

I'm pretty sure the plugin is installed correctly. If I ls plugins I have fetch.json, ios.json and cordova-plugin-ble, as well as cordova-plugin-whitelist. The plugin is also then present in some form in /platforms/ios/www and /platforms/ios/platform_www

Re: Uncaught TypeError: cannot call method 'stopScan' of 'undefined' source: file:///android_asset/www/app.js

Posted: 22:42, 29 Dec 2015
by micke
@josephclawrence

One thing to try is building the Evothings Viewer app and see if that works. Build instructions are provided here:

https://github.com/evothings/evothings-viewer

Evothings Viewer is easier to build than Evothings Client (and works with Evothings 2.0). The build depends only on Cordova.

Modify the list of plugins in this file:

https://github.com/evothings/evothings- ... ckage.json

You can for example remove plugins you do not need, and add ones not included.

Let me know ho it goes!

Best, Mikael