PhoneGap Microsoft Band Plugin

Jesse MacFadyen
aka @purplecabbage

About Me

  • PhoneGap developer since 2008
  • Can't believe it's been that long.

Jesse MacFadyen
aka @purplecabbage

What is the Microsoft Band?

What can the Microsoft Band do?

What can the Microsoft Band do?

  • Sensors
  • Fitness Tracking
  • Notifications
  • Haptics
  • Sleep Tracking
  • Can be personalized

Sensory Overload

  • HeartRate
  • BandContact
  • Skin Temperature
  • UV Level
  • Accelerometer
  • Gyroscope
  • GPS
  • Pedometer
  • Distance

What devices does it work with?

  • iOS
  • Android
  • Windows 8.1+ (Universal)

And now it works with PhoneGap too!

  • Currently just iOS, but others soon.
  • Apache 2.0 Licensed and on github

What can the plugin do?

  • Get band info
  • Read and watch sensors
  • Create tiles and send notifications
  • Get and set theme colors

How to install



// not on npm yet
cordova plugin add https://github.com/purplecabbage/phonegap-plugin-msband.git

                    

Connecting to the band



function onDeviceReady() {
    msband.connect(onBandConnectSuccess,onBandConnectError);
}

function onBandConnectSuccess(evt) {
    isBandConnected = true;
    bandIcon.src="img/iconWhite64-2x.png";
}

function onBandConnectError(err) {
    isBandConnected = false;
    bandIcon.src="img/iconBlack64-2x.png";
}

                    

Subscribing to a sensor

                
msband.sensors.on("heartbeat",onHeartBeatUpdate);

function onHeartBeatUpdate(evt) {
    // evt has quality,heartRate + timestamp
}

// to unsubscribe 
function unSubHeartRate() {
    msband.sensors.un("heartbeat",onHeartBeatUpdate);
}
                
                    

How about a demo?

Challenges

  • Using Accelerometer + Gyro data
  • Color space issues

What's left to do?

  • Android, and Windows Universal support
  • Documentation
  • Tests would be nice
  • Input validation
  • Different tile messages/notifications

Questions?




Links






Photo Credits : www.microsoftband.com