cordova-pebble

    1.0.2 • Public • Published

    cordova-pebble

    Implementation of the Pebble SDK for Cordova. Supports Android and iOS.

    Installation

    Cordova CLI

    cordova plugin add https://github.com/tgardner/cordova-pebble.git

    Telerik AppBuilder

    appbuilder plugin fetch https://github.com/tgardner/cordova-pebble.git

    Usage

    Set the UUID of your companion app, and register callbacks for connect/disconnect events from watches:

    Pebble.setAppUUID("cb2efd3c-4fa5-4bb9-b99b-9e0a1f3f9b62", 
        function() { console.log('success'); },
        function(event) { console.log('failure'); });
    Pebble.onConnect(
        function(event) { alert('connected'); }
        function(event) { alert('disconnected'); });

    Launch your app:

    Pebble.launchApp(
        function() { console.log('success'); },
        function(event) { console.log('failure'); });

    Send a message to the watch:

    Pebble.sendAppMessage({0: "hello"},
        function() { console.log('success'); },
        function(event) { console.log('failure'); });

    Receive messages from the watch:

    Pebble.onAppMessageReceived(function(message){
        console.log(message);
    });

    Kill your app:

    Pebble.killApp(
        function() { console.log('success'); },
        function(event) { console.log('failure'); });

    Example

    Pebble.setAppUUID("cb2efd3c-4fa5-4bb9-b99b-9e0a1f3f9b62", 
        function() { 
            Pebble.onConnect(function(event) { 
                Pebble.onAppMessageReceived(function(message){
                    console.log(message);
                });
     
                Pebble.sendAppMessage({0: "hello"},
                    function() { console.log('message sent'); });
            });
        }
    );

    Install

    npm i cordova-pebble

    DownloadsWeekly Downloads

    12

    Version

    1.0.2

    License

    Apache 2.0

    Unpacked Size

    13.3 MB

    Total Files

    215

    Last publish

    Collaborators

    • tgardner