Fake Band The Microsoft Band Emulator

Wearable devices are very famous nowadays. 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. 
You can test you your apps without Band.

Fake Band is available now. Fake Band enables you to test you 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.

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,
  1. Install-Package FakeBand  

Step 4: Now, you are able to use the FakeBand library. The following code snippet helps you to understand the working. 

  1. FakeBandClientManager.Configure(new FakeBandClientManagerOptions  
  2.   {  
  3.       Bands = new List<IBandInfo>  
  4.       {  
  5.           new FakeBandInfo(BandConnectionType.Bluetooth, "Fake Band 1"),  
  6.           new FakeBandInfo(BandConnectionType.Bluetooth, "Fake Band 2"),  
  7.       }  
  8.   });  
  9.   
  10.   // Use the fake band client manager  
  11.   IBandClientManager clientManager = FakeBandClientManager.Instance;  
  12.   
  13.   // Microsoft Band SDK code  
  14.   var bands = await clientManager.GetBandsAsync();  
  15.   var bandInfo = bands.First();  
  16.   
  17.   var bandClient = await FakeBandClientManager.Instance.ConnectAsync(bandInfo);  
  18.   var meTile = await bandClient.PersonalizationManager.GetMeTileImageAsync();  
  19.   
  20.   var wb = meTile.ToWriteableBitmap();   
  21.   MeTileImage.Source = wb;  //MeTileImage is the name of Image XAML control

Get Sensor Data

  1. var uc = bandClient.SensorManager.Accelerometer.GetCurrentUserConsent();  
  2. bool isConsented = false;  
  3.   
  4. if (uc == UserConsent.NotSpecified)  
  5. {  
  6.     isConsented = await bandClient.SensorManager.Accelerometer.RequestUserConsentAsync();  
  7. }  
  8.   
  9. if (isConsented || uc == UserConsent.Granted)  
  10. {  
  11.     bandClient.SensorManager.Accelerometer.ReadingChanged += async (obj, ev) =>  
  12.     {  
  13.         await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>  
  14.         {  
  15.             // Update User Interface...  
  16.         });  
  17.     };  
  18.   
  19.     await bandClient.SensorManager.Accelerometer.StartReadingsAsync();  
  20. }  

Run the project

 
 

More


Similar Articles