A PhoneGap plugin to enable turning your device into a bluetooth peripheral. Currently only works with iOS. When peripheral support is added to Android I hope to integrate it here.
Objective-C JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


BLE Peripheral Manager Plugin for PhoneGap

This is my first PhoneGap plugin and first experience with Objective-C. It's a rough start, so I greatly appreciate any feedback for improving the code. There's a lot left to do to get this plugin up to par.

This plugin is only for Bluetooth Peripheral Manager functionality. If you're looking for Central Manager functionality check out https://github.com/randdusing/BluetoothLE.

Upcoming Improvements

  • ability to update a characteristic's value when Central Manager subscribes
  • improved error handling


phonegap local plugin add https://github.com/2WheelCoder/ble-peripheral-manager.git


BLEPeripheralManager.addService(service, successCallback)

Creates a service from an object you pass. All object parameters are required. You may call this multiple times to add multiple services, but all services must be added before you start advertising. This method is asynchronous, so pass a function to the success callback for any code you may need to run after the service has been added, which includes the startAdvertising method.


  • UUID: A UUID string. Create by running 'uuidgen' on the command line.
  • primary: True or false as to whether this is the primary service for your app. True if you are only running one service.
  • characteristics: An array of characteristics for this service. Each characteristic has two parameters, UUID and value, that are both strings. Characteristic values must be a string, not null, an array or an object. See example.

BLEPeripheralManager.startAdvertising('deviceName', successCallback)

Begin advertising. This must be called after at least one service has been created, so make sure to run this in the callback of the addService method. Pass in any string to represent the name of your device. This method is asynchronous, so pass a function to the success callback for any code you may need to run after advertising has begun.


Stops all advertising.


Removes all services from a class. Editing services is not yet possible, so you may need to run this to start from scratch if you need to update a service.

Example Usage

// Setup a service object. Generate your own UUIDs by running 'uuidgen' on the command line.
var service = {
	primary: true,
	characteristics: [
			value: 'characteristic1Value'
			value: 'characteristic2Value'

// Add your service
BLEPeripheralManager.addService(service, function success() {
	// Start advertising services
	BLEPeripheralManager.startAdvertising('aNameForYourDevice', function success() {

// Stop advertising when finished

// Remove all services