Introduction
Wearable devices are very famous now a days. Microsoft band is one of them. Currently, Microsoft Band 2 is in the market with a price of $249.99. Microsoft Band comes with a number of sensors, including GPS sensor for footstep counts, heart beat monitoring and many more. If you want to develop apps for Microsoft Band while having no band, you would not test your apps without Microsoft Band till today. But now, it is not a problem.
Fake Band is available now. Fake Band enables you to test your Band apps without Band. Fake Band is a library for developing and testing Band apps without connecting to physical Band device.
Steps are quite simple.
Step 1
Download and install the Band SDK from https://developer.microsoftband.com/bandSDK.
Step 2
Create a UWP project in Visual Studio.
Step 3
Get the Fake Band.
Write the following command in Package Manager console of Visual Studio.
Install-Package FakeBand
Step 4
Now, you are able to use the FakeBand
library. The following code snippet helps you to understand the working.
FakeBandClientManager.Configure(new FakeBandClientManagerOptions
{
Bands = new List<IBandInfo>
{
new FakeBandInfo(BandConnectionType.Bluetooth, "Fake Band 1"),
new FakeBandInfo(BandConnectionType.Bluetooth, "Fake Band 2"),
}
});
IBandClientManager clientManager = FakeBandClientManager.Instance;
var bands = await clientManager.GetBandsAsync();
var bandInfo = bands.First();
var bandClient = await FakeBandClientManager.Instance.ConnectAsync(bandInfo);
var meTile = await bandClient.PersonalizationManager.GetMeTileImageAsync();
var wb = meTile.ToWriteableBitmap();
MeTileImage.Source = wb;
Get Data from Sensors
var uc = bandClient.SensorManager.Accelerometer.GetCurrentUserConsent();
bool isConsented = false;
if (uc == UserConsent.NotSpecified)
{
isConsented = await bandClient.SensorManager.Accelerometer.RequestUserConsentAsync();
}
if (isConsented || uc == UserConsent.Granted)
{
bandClient.SensorManager.Accelerometer.ReadingChanged += async (obj, ev) =>
{
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
});
};
await bandClient.SensorManager.Accelerometer.StartReadingsAsync();
}
For more details, check out http://peted.azurewebsites.net/fake-microsoft-band/.
Fake Band on GitHub can be found at https://github.com/BandOnTheRun/fake-band.