简体   繁体   中英

Microsoft Band SDK for Windows Store 8.1 app?

The documentation for the Microsoft Band SDK Preview claims it supports WinRT 8.1 for Windows applications but after downloading the NuGet package (1.3.10219-preview) into my Windows Store C# project I ran into some major roadblocks:

First, when I tried building after immediately adding the NuGet package I got the following compilation errors:

Payload file 'C:\...\packages\Microsoft.Band.1.3.10219-preview\lib\portable-win81+wpa81\Microsoft.Band.Store\Tiles\AddTilePage.xbf' does not exist. 
Payload file 'C:\...\packages\Microsoft.Band.1.3.10219-preview\lib\portable-win81+wpa81\Microsoft.Band.Store\Microsoft.Band.Store.xr.xml' does not exist.   

Second, the documentation says to add the following invalid XML into the Package.appxmanifest :

 <DeviceCapability Name="bluetooth.rfcomm">
   <Device Id="any">
     <!-- Used by the Microsoft Band SDK Preview -->
     <Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />
     <!-- Used by the Microsoft Band SDK Preview -->
     <Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />
   </Device>
 </m2:DeviceCapability>

Third, the Microsoft.Band.Store.dll assembly doesn't contain a BandClientManager so I can't get a reference to my band as described in the documentation.

I was able to work around the first and second issues by copying the missing files from the wpa81 NuGet package and adding the m2: prefix to all XML elements respectively, but I have no idea how to get around the third problem. Poking around with .NET Reflector it looks like the functionality may be there locked away in some internal classes but I don't see anything in the public types.

Is there anyway to get this working on Windows or does it only work on Windows Phone?

The initial Microsoft Band SDK Preview (1.3.10219-preview) was focused on Windows Phone and so does not contain NuGet targets specifically for Windows Store applications. It allows the bundling of Band-related logic within a portable library that targets both Windows Phone and Windows Store--notwithstanding the packaging issue you encountered--but does not allow the creation of IBandClient instances on Windows Store.

The new SDK now supports Windows Store Apps :)

-------OLD------

I was able to access the BandClientManager in my Windows Store App using a little bit of reflection, and could access everything in the SDK except subscribing to sensor data as that part uses the RfcommDeviceService.Device type which is only accessible on Windows Phone.

Could also connect using the socket APIs, but then there is the matter of reading and writing data and interpreting it :P

在此处输入图片说明

I've spent some time with the SDK, and got tired of having to connect the band to my phone and deploy the app to the phone for testing/debugging, so I ended up creating a simulator that wraps the SDK. I guess you could do something similar for the missing bits. The simulator uses sockets to send data that is either pre-recorded (using a file- and will then animate the movements) or by manipulating the 'band' with the mouse/touch as you do with the Windows Phone emulator.

Obviously these are only temporary solutions or for development purposes until a Store compatible SDK is released.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM