cordova-galaxygear

1.0.0 • Public • Published

Cordova Galaxy Gear Plugin

The plugin has functions that allows your app to have bidirectional communication with Samsung Gear 2 Series Tizen applications and Cordova applications.

It supports the various Android Samsung models listed here.

Installation

With Cordova CLI, from npm:

$ cordova plugin add cordova-galaxygear
$ cordova prepare

Usage

  1. Install the plugin in your Cordova project.

  2. Add a res/xml/assessoryservices.xml file to your Tizen project with the following

<resources>
    <application name="CordovaGearConsumer" >
        <serviceProfile
            id="/system/cordovagearprovider"
            name="cordovagearprovider"
            role="consumer"
            version="2.0" >
            
            <supportedTransports>
                <transport type="TRANSPORT_BT" />
            </supportedTransports>
 
            <serviceChannel
                id="104"
                dataRate="low"
                priority="low"
                reliability="enable" >
            </serviceChannel>
        </serviceProfile>
    </application>
</resources>
  1. Modify the config.xml file in your Tizen project and add the following under the <widget> node
<tizen:metadata key="AccessoryServicesLocation" value="res/xml/accessoryservices.xml"/>
<tizen:privilege name="http://developer.samsung.com/privilege/accessoryprotocol"/>

A great example of this is the Hello Accessory example from the SDK

Example

GalaxyGear.onConnect(function(e) {
    alert("Connection Successfully Established - handle: " + e.handle);
    
    GalaxyGear.onDataReceived(e.handle, function(e) {
        alert("Data received - handle: " + e.handle + " data: "+ e.data);
    });
    
    GalaxyGear.sendData(e.handle, "Hello From Cordova!");
});

Package Sidebar

Install

npm i cordova-galaxygear

Weekly Downloads

1

Version

1.0.0

License

Apache 2.0

Last publish

Collaborators

  • tgardner