Skip to content

Cordova plugin that allows your app to have bidirectional communication with the Samsung Gear 2 Series.

License

Notifications You must be signed in to change notification settings

overmob/cordova-galaxygear

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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!");
});

About

Cordova plugin that allows your app to have bidirectional communication with the Samsung Gear 2 Series.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 97.6%
  • JavaScript 2.4%