Category Archives: Windows Phone 8.1

Microsoft Band API

So I just started looking at the SDK for the Microsoft Band. It’s pretty good, but bear in mind that there are limitations, for example, you can only gather “live” sensor data – there’s no way to get any cached stats that may (or may not) be on your device.

Having said that, here’s a quick overview of using the SDK.

Microsoft Band
The Band

Preparing the solution

First thing to do here is to make sure your band is paired with your phone, turned on and active. Once that’s done, open Visual Studio and create a new phone project.

The SDK is available via NuGet, so add a reference to it.

You should see that references have been added to the required assemnblies, but also your package.appxmanifest file will have been updated with the following device capabilities.

These allow the app to communicate with your Band.

Now you can get going.

Connecting to your Band

In your page, get a list of the paired band devices on the system with the following command. Note that I return from the method if there are no paired Bands. You’ll need to set a using reference to Microsoft.Band.

Once you have your list of Bands, you can connect to one. In this case, I’m assuming we always want to connect to the first connected device, but you can modify this bit to suit your needs.

Note: The tutorials suggest you wrap the returned client instance in a using block, but if you do that then later steps like collecting sensor data won’t work because the client is disposed when this method returns. I hold a local reference to the client object and dispose it in OnNavigatedFrom();

At this point we can start getting basic data back, like the hardware and software versions.

Gathering sensor data

Now we get to the fun stuff. Assuming you followed my advice above about holding a local reference to the client object, you can start getting sensor data back. In this case, the HeartRate data.

Add a using statement for Microsoft,.Band.Sensors, then you can subscribe to events.

Since all this work takes place on its own thread, you’ll need to do a little bit of juggling to get this data onto the screen. Specifically use the CoreDispatcher to invoke the action on the UI thread. You might like to set up a method to keep this simple…

and then call it like so…

for example.

Next time – more on sending notifications and personalising your Band.

Nokia Imaging SDK updated

Not surprising news, but worthy of a big mention. The Nokia Imaging SDK has had a new beta release (1.2).

This release brings all the goodness of the Phone library to the new, conjoined Microsoft platform across Windows 8.1 and Windows Phone 8.1. I am hoping to find a little time to play with the new SDK over the next week or so, but the sample apps and code look great. There are also sample apps in the Windows store, although the links in the site seem not to work. I’d suggest opening the Windows Store and searching for “Filter Effects” and installing the one published by Nokia.