Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Bluetooth communication with Phonegap?

I'm intended to program an interface with HTML/JAVASCRIPT/jQuery to control an electronic device. The communication must be via Bluetooth (there's already an instruction set to control the device in existence, and the device is already Bluetooth-capable), and this interface should be portable to an android app via Phonegap...

so I would love to get some advice in how to establish a Bluetooth communication with HTML or JAVASCRIPT, and to port it via Phonegap... tutorials, books, or whatever kind of hint will be warmly wellcomed!

like image 263
DrKiss Avatar asked Jun 29 '12 12:06

DrKiss


1 Answers

Quick answer: You have to write your own cordova/phonagap plugin.

Longer answer:

The only way to establish communication between HTML and native phone API within cordova/phonegap is to use Phonegap Plugin API. The plugin API works as a bridge between the phone and the browser JS.

You have to write native code for you target platforms and JS.

The most tricky part is to unify the handling of different native APIs from the different mobile platforms on the JS site. For a single targeted platform the complexity is quite manageable.

Phonegap has an github page with almost all available plugins open sourced. You could use them as examples. There are also some tutorials available.

like image 129
Roman K Avatar answered Nov 01 '22 03:11

Roman K