Wednesday, 5 August 2015

Developing a Microsoft Band App Using Windows Universal Apps i.e Windows 10

Last week I finally picked myself up a Microsoft Band and instantly started thinking about potential app ideas and that's where they were left, as thoughts :) However unfortunately I also got knocked off my bike last week and ended up with a fractured elbow (at least this is all it was). Today I finally got my sling off and have been given a ton of Physio exercises so I can actually get my arm moving properly again, at the moment it sucks.

These Physio exercises have to be done every hour in order to ensure I regain full mobility of my arm but it's kind of a drag to remember. I started by simply using the Band's Countdown App to remind me to do these, but whilst traveling this afternoon I thought of writing an App that not only reminded me to do these exercises but also logged and could display how many iterations of the exercises I performed and how fast etc. Needless to say tonight I started playing with the Band SDK and decided to start a series of blog posts that outlines how I get on and things I learnt etc.

Stage One - Getting a Windows Universal App up and running.

I started off by getting a new Windows Universal App created and then using Nuget to install the Band SDK Package [Microsoft.Band]. I then looked through the Microsoft Band SDK documentation on how you need to set things up etc. Here's where I noticed that the documentation and infact a lot of the SDK is all targeted at Windows 8.1 but I'm trying to write for the Windows 10 era. So for Universal Windows Apps where in the SDK documentation it talks about "Windows Store Applications Capabilities" you need to do the following:

  1. Open Package.appxmanifest and navigate to the Capabilities tab
  2. Then scroll down to the Proximity checkbox and enable it
  3. Right click your package.appxmanifest within solution explorer and select View Code. Note: if this is still open from the previous step you'll be prompted that the designer will be closed.
  4. Navigate to the Capabilities XML Node and add the following to the bottom:
<DeviceCapability Name="bluetooth.rfcomm">
   <Device Id="any">
    <!-- Used by the Microsoft Band SDK -->
    <Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />
    <!-- Used by the Microsoft Band SDK -->
    <Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />
   </Device>
  </DeviceCapability>

With this done you can then follow the other code samples within the SDK documentation which I won't document here. What I do want to mention is how on first appearances is quite easy and clear to use. You ensure you have permissions to use a sensor, you start / stop collecting readings and readings are raised via events with some easy to understand structured types, and as you'd expect it's all async. :)

In my next post I'm going to talk about how I've decided to make use of some of the sensor data and how to manage the sheer volume.

No comments:

Post a Comment