Monday, March 4, 2013

PhoneGap Bluetooth Plugin Updated

So the Bluetooth plugin was horribly out of date so I took some time to update it to work with PhoneGap 2.2.0 and higher. As well as the usual updates to the JS and Java code I fixed an instance in the "listDevices" call which would block code execution for 10 seconds while it scanned for devices.

Anyway, if you need Bluetooth functionality the plugin provides the following method:

  • listDevices
  • isBTEnabled
  • enableBT
  • disableBT
  • pairBT
  • unPairBT
  • listBoundDevices
  • stopDiscovering
  • isBound

Update: Oh by the Hoary Hosts of Hogarth! I should mention that I didn't originate this plugin, I just saw the need for it to be updated. All credit should go the original authors: Daniel Tizón, Idoia Olalde and Iñigo González


Naga Harish Movva said...

Nice plugin..

Abulafia said...

Hi Simon,
great job.
Do you have a shot example, how to send/receive data to a (paired) bluetooth device?

I'm using cordova 2.3.0 w/ android


Unknown said...

Hi Simon! Do you think that a serial port plugin to read data off USB is on the horizon?

I've looked into it and it seems complex.


Simon MacDonald said...


I have no plans to do one right now.

Simon MacDonald said...


Hopefully the device you are pairing with has an SDK but if not:

bedorlan said...

Nice! works very well!! thanks!!

Adha Dimas Liyanto said...

Sir i want ask you , how can make widget with phonegap ?

Simon MacDonald said...

@blogger for study

You would have to write it in native Android code. PhoneGap is a cross platform framework for creating apps and Widgets are pretty specific to Android.

Unknown said...

Is it compatible with Bluetooth Smart?

Simon MacDonald said...

@Adrien Giboire

Don't see why not.

yoga surya said...

hi simon

i m not able to download the GIT repo

Simon MacDonald said...

@yoga surya

Okay, not sure what to tell you. The file downloads fine for me.