Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time Cordova plugin for iOS & Android (alpha)

p2pkit is a peer-to-peer proximity SDK for iOS and Android

p2pkit is an easy to use SDK that bundles together several proximity technologies kung-fu style! With p2pkit apps immediately understand their proximity to nearby devices and users, estimate their range and exchange information with them.

Get Started

  1. Using p2pkit requires an application key, start by creating a p2pkit account here: Create p2pkit account

  2. Once you have an account you can log-in to the console and create an application key: Create your Application Key. p2pkit validates bundleID/package_name so don't forget to add to the known BundleID/package_names when creating your application key

  3. Download (or clone) the cordova plugin and unzip it: Download plugin

  4. Download and place P2PKit.framework in the cordova-plugin-p2pkit-io/lib/ios folder: Download p2pkit

  5. Add the cordova plugin to your project

cordova plugin add PATH_TO_PLUGIN --variable BluetoothPeripheralUsageDescription="describe why you use p2pkit" --save
  1. iOS only: Remove and add the platform
cordova platform remove ios
cordova platform add ios


Here is an example app class extension that implements p2pkit functionality begin by calling startP2PKit():

    p2pkitCallback : {

        onEnabled: function() {
            console.log('p2pkit is enabled')
            cordova.plugins.p2pkit.startDiscovery('', cordova.plugins.p2pkit.HIGH_PERFORMANCE) // base64 encoded Data (bytes)

        onDisabled: function() {
            console.log('p2pkit is disabled')

        onError: function(errorObject) {
            console.log('p2pkit failed to enable on platform ' + errorObject.platform + ' with error code ' + errorObject.errorCode)
        onException: function(exception) {
          console.log('p2pkit crashed with exception ' +exception.exception)

        onDiscoveryStateChanged: function(discoveryStateObject) {
            console.log('discovery state updated on platform ' + discoveryStateObject.platform + ' with state ' + discoveryStateObject.state)

        onPeerDiscovered: function(peer) {
            console.log('peer discovered '+peer.peerID)

        onPeerLost: function(peer) {
            console.log('peer lost '+peer.peerID)

        onPeerUpdatedDiscoveryInfo: function(peer) {
            console.log('discovery info updated for peer ' + peer.peerID + ' info ' + peer.discoveryInfo)

        onProximityStrengthChanged: function(peer) {
            console.log('proximity strength changed for peer ' + peer.peerID + ' proximity strength ' + peer.proximityStrength)

        onGetMyPeerId: function(reply) {

        onGetDiscoveryPowerMode: function(reply) {

    ppkErrorListener: function(error) {

    startP2PKit: function() {
        cordova.plugins.p2pkit.enable("<YOUR APPLICATION KEY>", this.p2pkitCallback, this.ppkErrorListener)


The full API for the plugin is available at www/ppk.js

In general, a tutorial as well as more documentation for p2pkit is available on our website at:

p2pkit License

  • By using P2PKit you agree to abide by our Terms of Service, License Agreement and Policies which are available here:
  • Please refer to "Third_party_licenses.txt" included with P2PKit.framework for 3rd party software that P2PKit.framework may be using - You will need to abide by their licenses as well


A cordova plugin for




No releases published


No packages published
You can’t perform that action at this time.