Any used chrome cordova bluetooth

92 views
Skip to first unread message

Chandrayee Basu

unread,
Mar 14, 2015, 11:46:14 PM3/14/15
to chromi...@chromium.org
Hi 

Does anyone have an example of using this Chrome.bluetooth plugin: https://github.com/MobileChromeApps/cordova-plugin-chrome-apps-bluetooth ? I am trying to understand how to write a javascript for the index.html for this plugin. Is there a documentation for using plugins in general, also?

Thanks
Chandrayee

Michal Mocny

unread,
Mar 15, 2015, 12:16:38 PM3/15/15
to Chandrayee Basu, Chromium Apps
The documentation for the api is the same as for desktop, and the github repos for these plugins (See [1][2][3] below) point to the docs.  There are no additional comments in this particular plugins, but often we document amendments to the apis in our github repos.


--
You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.
To post to this group, send email to chromi...@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-apps/.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

khang hoang

unread,
Mar 16, 2015, 7:20:29 AM3/16/15
to chromi...@chromium.org
Gj

Chandrayee Basu

unread,
Mar 18, 2015, 7:02:03 PM3/18/15
to chromi...@chromium.org
Hi Michal

Here is my code within index.html to call the bluetooth methods. The goal is to start discovery on a button click.

<script type="text/javascript">
    function init() {
        $("#btn-bt-discover").click(function(){
            bluetooth.startDiscovery(onSuccess)
        });
    }
    $(document).on("deviceready",init);
</script>

This code does not function properly. I was expecting the phone bluetooth to turn on. I am new to javascript and html. May be I am doing something wrong. Any suggestion?

Michal Mocny

unread,
Mar 24, 2015, 4:43:32 PM3/24/15
to Chandrayee Basu, Chromium Apps
I would start by scanning the console for errors, and also suggest you add alert() (or console.log) to make sure the events fire, and to see if onSuccess is called.

Also note that startDiscovery callback is called on failure as well as success, so you should check the value of the arguments.

--

Bobby Powers

unread,
Mar 24, 2015, 4:48:02 PM3/24/15
to Michal Mocny, Chandrayee Basu, Chromium Apps
I've used cordova bluetooth for interacting with bluetooth low energy devices to great success on android + iOS.  The scanning code is here:

Please note that bluetooth LE discovery and bluetooth discovery are completely separate.  One thing Chandrayee - you need to use `chrome.bluetooth.*`, not `bluetooth.*` AFAIK.

yours,
Bobby
Message has been deleted

Chandrayee Basu

unread,
Mar 27, 2015, 5:23:34 PM3/27/15
to Bobby Powers, Michal Mocny, Chromium Apps
Bobby, thanks for the link. I will try these out. Michal, I logged the error messages. Actually the event chrome.bluetooth.startDiscovery() fires, but there is not corresponding error log. 

Best
Chandrayee
Reply all
Reply to author
Forward
0 new messages