2

Microsoft Band 2に接続しているSurface Pro 3にWindows 10 UWPアプリケーションを作成しています。私はフォアグラウンドでアプリを実行しているときにそれをちょうど良い。Microsoft Band 2 + UWP +バックグラウンドタスク=> Bluetoothデバイスサービスの取得中にエラーが発生しました

私はDeviceUseTriggerを使用して、バックグラウンドタスクでいくつかのロジックを実行しようとしています。私は次のエラーを取得する

var bandInfo = (await BandClientManager.Instance.GetPairedBandsAsync()).FirstOrDefault(); 
var bandClient = await BandClientManager.Instance.ConnectAsync(bandInfo); 

::私はメソッドを呼び出すと、バンドに接続するための

<DeviceCapability Name="bluetooth" /> 
<DeviceCapability Name="location" /> 
<DeviceCapability Name="proximity" /> 
<DeviceCapability Name="bluetooth.rfcomm"> 
    <Device Id="any"> 
    <Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" /> 
    <Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" /> 
    </Device> 
</DeviceCapability> 

そして、この:

An error occurred while attempting to acquire the Bluetooth device service. This error can occur if the paired device is unreachable or has become unpaired from the current host.

は、私は私のUWPのappxmanifestに以下の機能を追加しましたバックグラウンドタスクの宣言です。

<Extensions> 
    <Extension Category="windows.backgroundTasks" EntryPoint="WindowsRuntimeComponent1.BandBackgroundTask"> 
    <BackgroundTasks> 
     <Task Type="deviceUse" /> 
     </BackgroundTasks> 
    </Extension> 
</Extensions> 

答えて

0

ちょうど推測ですが、Band SDK documentationのこの段落はGetPairedBandsAsyncのお電話にも役立つでしょうか?

If your app wants to connect to the Band from the background, then the app should call GetBandsAsync(isBackground: true) to get a connection that will not interfere with any app that is running in the foreground and currently using a Band connection.

+0

返信いただきありがとうございました。私はその部分を紛失しました。 これを変更しましたが、残念ながら同じエラーが発生しています。私が何をやっているのか分かりません...:/ –

関連する問題