Developing for the Microsoft Band Link Round-up

News

Extraordinary Robot
Robot
Joined
Jun 27, 2006
Location
Chicago, IL
Now that the Microsoft Band is pretty easily purchased (I'm wearing one of the latest batch now :) more dev's are getting them and sharing their efforts.

Instead of rationing them, I'm going to give you a round-up of them, posts from Iris Classon (two from her actually), Fela Ameghino, Lorenzo Rossoni, James Croft and James Chambers.

Here's our recent Microsoft Band posts;

IoT For Humans (and Developers) – Getting Started with my Microsoft Band


Making the “Internet of Things” make sense to observers outside the industry is going to take a lot of work. While we might grow frustrated with the overuse and below-required understanding of the term, I would argue that in the industry we have a long way to go to fully understand the implications of security, health, privacy, etiquette, social dynamics, productivity and individualism.

But while the term may seem obscure, especially hiding being other abstractions like “connected devices” and mixed in with other buzzwords like “big data”, the reality is that…it’s here.

The auto industry embraced the “of Things” part really well quite some time ago, well before mainstream internet in fact, and has been increasingly good and getting the “Internet” part as well.

As a consumer, it would appear that my van sends me an email when it needs an oil change; in reality there is a query or a push occurring at some set interval or cued off of some trigger when I’ve reached a certain amount of mileage. That push or pull stores a flag in a database, which is later picked up by some service, likely processed through some kind of templating engine and mixed with my past service records and ultimately delivered to my inbox. But, dang, my van sends me emails, Mom!

Bringing IoT Home For .NET Developers


Even to me as a developer, while I’ve sensed these “Things” emerging around me it’s still been hard to find a way to explore them. You can’t get application development guidance or a NuGet package for your Chevy Uplander.

In many ways our phones have really become these interconnected devices as well, becoming more and more sensor-laden in a world where LTE and Wi-Fi signals have broader reach. Android watches and even the Pebble watch spaces have SDKs if you’re familiar with those development ecosystems or cross-plat tools to target specific devices.

But last week, my Microsoft Band showed up. And there is both an SDK and guidance freely available. As a developer on the .NET stack and solid knowledge of Azure, I can’t help but feel that my playground just got a lot bigger.

What I Get as a Tinkerer


So, for about $200, and leveraging my Azure benefits, I am like a kid in a candy shop. Here’s what I have:

... [Click through for the whole post]
Band Studio for Visual Studio

Incipit


All is started on January 10th 2015, when we have found some custom layouts in Band firmware. After few days of work we’ve successfully reversed them and we’ve got an idea on how these layouts works.

We’ve also worked on an SDK for Windows Phone to use them in a real context, and I’ve published a demo app that uses them.

Initially we built layouts from scratch, using a standard Hex Editor, but then we’ve got the idea to create a Visual Studio designer for them, we’re layouts are written in XML and then “compiled” in bytes during application compile process.

Now official SDK (Preview) is out, and I have created an extension library for it.



... [Click through to get the Extension]
Developing for Microsoft Band with WinRT : Band Tiles


In this post, I'm going to cover the basics of getting a new 3rd-party tile for your application onto the Microsoft Band with WinRT using the SDK.

If you'd like to see how to get started with Band development, you can check out my previous posts on getting connected and accessing sensors!

We're going to carry on from those previous posts so if you're unsure of where you're at, go back and have a quick look and we will carry on from there.

So, now we've got ourselves connected with the Band and have learned how to access the sensors. The next logical step is getting your tile onto the Band. If you're familiar with the Band by now, you'll be very familiar with it's Windows style app tiles which reside to the right of your 'Me Tile'. This tutorial will walk you through how to get your app tile into that area.

How many tiles remain?

One of the first things we need to do before we can put our tile onto the Band however is to check if we have enough space for it. Unfortunately, the Band doesn't allow for tens of apps on it at one time and this limitation means that if there isn't enough space, you can't activate your own tile on it.

Luckily the BandClient exposes the TileManager which has a nifty method called GetRemainingTileCapacityAsync.

The method returns an integer value which you can use when you're ready to add a new tile as follows:

... [Click through to see the code and read the rest...]
Developing for Microsoft Band Tutorial part 1


The blog has been bit more quiet than usual the last two weeks as I have been working on a new course for Pluralsight on Microsoft Band, a course I’m wrapping up this weekend (if all goes as planned). I’ve gotten to know the device and the SDK rather well over the last month or so and would love to share with you a detailed tutorial that covers the SDK in details, as well as some ideas for applications, cover bugs and peculiars (at the time of writing the SDK is still in preview) related to the SDK, the band and the environment.

For this tutorial I recommend Windows 8.1 or up, Visual Studio 2013 and up (community edition is a free version you can use), and Windows Phone 8.1 SDK. However, the band has SDK for iOS and Android as well, and you can also use Xamarin.

In this part I’m going to cover setting up the environment and a little bit about the device so we can get started immediately. In every upcoming tutorial part I’ll cover more and more about the device so we can get a good mix of information and code, as it makes more sense to talk about the details as we are actually integrating those parts in our application.

...

Create a WP project


Just do a a file, new project, Windows Phone
icon_smile.gif
:)
">​

Install package using NuGet console


Install-Package Microsoft.Band –Pre

If you use the package manager UI (right click on project, Nuget Package Manager) make sure that you have selected pre-release in the left dropdown before searching for the Microsoft Band SDK (online)



... [See the rest of Part 1]

Developing for Microsoft Band Tutorial part 2: Connecting to the band and retrieving band information


Let’s talk code.

The SDK allows us to connect to one or more bands, but since I only have one we will only use one for the tutorial. For communication the bands uses Bluetooth so before we even attempt to find and connect to a band it makes sense to check if the user has Bluetooth enabled. Unfortunately (as far as I know) in 8.1 there isn’t a straight forward easy to do that and usually you use the native Bluetooth API to see if there are nearby peers or devices. If none it might be off. Since we specifically want to connect to a band we can use the SDK for the band to look for Microsoft Band devices- under the cover it does what the native Bluetooth APIs do but only returns paired bands. This also means that that specific line will not through an exception if none are paired, it will simply return an empty array. This is how we look for paired Microsoft band devices

var bandManager = BandClientManager.Instance;
var pairedBands = await bandManager.GetBandsAsync();

If none are found we could notify the user and suggest that they make sure that Bluetooth is enabled under settings and the device is paired by providing a link that will open up Bluetooth settings. This is how we launch Bluetooth settings:

await Launcher.LaunchUriAsync(new Uri("ms-settings-bluetooth:"));

Let’s take a step back and talk about the band client manager class. The SDK has currently five managers, each with the following responsibilities:



The BandClientManager used for finding devices and connecting to them, as well as retrieving hardware and firmware information once we have connected to the band through the return type IBandClient. The name of the device is retrieved directly from the BandClientManager, the same goes for connection type (USB or Bluetooth).
The NotificationManager let’s us send messages, dialogs and vibrations
The PersonalizationManager manages the me-tile (main tile on the band) and themes for the band.
The TileManager is what we use to manage our own tile (and the tile theme is set as a property on the tile if you want a separate theme on the tile)
The SensorManager is of course as the name implies how we access sensors, this also includes the sensor that tells us if the band is worn or not.

... [For the rest of Part 2...]

THAT should be enough to get you all started!

Follow @CH9
Follow @coding4fun
Follow @gduncan411

njs.gif


Continue reading...
 
Back
Top Bottom