How to use bluetooth / BLE via PhoneGap or etc?


#1

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. https://github.com/don/BluetoothSerial – more serial centric which I will need (assuming it does BLE)
  2. https://github.com/don/cordova-plugin-ble-central – 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.


Phonegap bluetooth and nsbasic/app
#2

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

https://cordova.apache.org/plugins/?q=BLE

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


#3

@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 discuss.nsbasic.com/c/phonegap ) 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.


#4

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


#6

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


#7

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