How to use bluetooth / BLE via PhoneGap or etc?

Hi. Does anyone have an example on how to use Bluetooth / BLE via PhoneGap or similar? (Specifically, I need to receive BLE data, serially or otherwise, on Android 4 and 5 on Samsungs 2, 6 & 7).

I found the FAQ @ wiki.nsbasic.com → /NSB/App_Studio_FAQ#Tell_me_more_about_Bluetooth.21 on this subject and I found the below two PhoneGap plugins…

  1. GitHub - don/BluetoothSerial: Cordova (PhoneGap) Plugin for Serial Communication over Bluetooth – more serial centric which I will need (assuming it does BLE)
  2. GitHub - don/cordova-plugin-ble-central: Bluetooth Low Energy (BLE) Central plugin for Apache Cordova (aka PhoneGap) – which has good scan support.

As I am new to this (am a highly experienced VB6 programmer sorry :slight_smile: , and almost average with JScript), it would be great to get a heads up on getting started.

I note the FAQ (above link) says…

  1. “there is a Bluetooth plugin for PhoneGap” - which is recommended?
  2. “PhoneGap Build makes it easy to compile AppStudio + Plugin apps” …
    2.1 - I have used “Make Native App with PhoneGap” in the IDE, but how do I load the plug in etc etc?
    2.2 - How do I call a PhoneGap plugin from NSB (pref in VB)?

  • …Of course, the use of PhoneGap may not be necessary as most BLE Scan & Pairing functions etc are handled by Android, so if there is some universal way of opening a stream… (Eg: in Windows, Bluetooth can be treated purely as serial). I’m also familiar with sockets concepts.
  • If this can only be achieved by PhoneGap, then maybe this Query should be there – I will leave admin to decide :slight_smile: .

Any and all hints, tips and examples would be amazingly helpful. Thank you.

Yes, you are correct. You’ll need to use a PhoneGap plugin for Bluetooth for this. There are a number of plugins for this:

We do not have a sample for this - contact me offline if you would like us to develop one for you.

@Leader , thanks! For the benefit of others, I’m now studying https://wiki.nsbasic.com/Using_the_PhoneGap_API and also working examples such as https://wiki.nsbasic.com/Using_the_PhoneGap_API:_Pushwoosh (& of course http PhoneGap - AppStudio ) and I hope to resolve it and leave a few tips here.

If anyone can recommend a good simple working example of any PhoneGap plugin (pref tested and downloadable please :slight_smile:), I’d appreciate the heads up.

A number of samples of using PhoneGap come with AppStudio. Do Open Sample and enter phonegap into the search field.

Thanks. Did not know the examples were so inclusive. Excellent.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.