Windows Phone 8.1(商店)应用,MS Band SDK v1.3.20217
Foreground app效果很好,因为我已经授权用户与相关乐队交谈。我到了我
的地步client = await BandClientManager.Instance.ConnectAsync(band);
我遇到了
Microsoft.Band.BandAccessDeniedException occurred
Message: Exception thrown: 'Microsoft.Band.BandAccessDeniedException' in Microsoft.Band.Store.DLL
Additional information: A non-specific error occurred while attempting to acquire the Bluetooth device service. This error can occur if the application manifest does not have the required permissions for opening the Bluetooth connection to the Microsoft Band, or if the user denies access.
虽然我的应用清单有:
<Capabilities>
<Capability Name="internetClientServer" />
<DeviceCapability Name="proximity" />
<DeviceCapability Name="bluetooth.rfcomm" xmlns="http://schemas.microsoft.com/appx/2013/manifest">
<Device Id="any">
<!-- Used by the Microsoft Band SDK -->
<Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />
<!-- Used by the Microsoft Band SDK -->
<Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />
</Device>
</DeviceCapability>
</Capabilities>
当我从客户经理获得目标频段时,我正在做:
var bands = await BandClientManager.Instance.GetBandsAsync(true);
band = bands.FirstOrDefault(b => b.Name == targetBandName);
所以我表示这是从后台启动的,它成功地让我回到Microsoft.Band.Store.BluetoothDeviceInfo
实例投入ConnectAsync
知道发生了什么事吗?
答案 0 :(得分:1)
如果我将GetBandsAsync(true)
更改为GetBandsAsync()
,则此问题就会消失。当ConnectAsync
实例来自BluetoothDeviceInfo
GetBandsAsync(true)
中出现了一个错误
答案 1 :(得分:1)
愚蠢的答案,但万一有人发现这一点,就像我通过Bing做的那样:
来自SDK文档的<2.3> 2.3.1:“应用程序需要声明访问蓝牙硬件资源所需的相应权限。为此,请手动更新应用程序的Package.appxmanifest文件的Capabilities部分以包含以下内容: “...基本上,它是Package.appxmanifest Capabilities选项卡中的一个复选框。是的,这很明显,但我没有意识到这一点。 HTH某人。
注意:这与b3tech看到的问题是正交的,但表现相同。