locked
Get exception when connecting to bluetooth in background task

    Question

  • Hello,

    I got the following exception when trying to connect to bluetooth in background task:

    HResult: -2147483634
    Message: A method was called at an unexpected time.

    Bluetooth sockets cannot be used while suspended.

    Please help.

    Thank you


    • Edited by Lion DEV Thursday, May 15, 2014 3:54 PM
    Thursday, May 15, 2014 3:53 PM

Answers

  • Hi LionDev,

    As Accessing sensors and devices from a background task mentioned, DeviceUseTrigger for Bluetooth is supported by Windows Store App. See Best Practice to see if it helps.

    However I guess you are using win8.0, starting in Windows 8.1,  a Windows Store device apps can perform multi-step device operations in a background task so that they can run to completion even if the app is moved to the background and suspended. See this for more information : Bluetooth devices

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, May 16, 2014 8:30 AM
    Moderator