locked
How to handle app resume and suspend for bluetooth devices ?

    Question

  • Hi

    I have gone through the Bluetooth RFCOMM chat app, could not find anything related to how to handle app suspend and resume in the sample.

    Basically I wanted to:

    - start the app

    - let the user choose a BT device to connect to via RFCOMM

    - let the user work on it

    - if the app goes to back ground/suspended, suspend the BT device

    - if the user swap the app back to front ground, it automatically reconnect to the last selected bt device and the user can resume operation.

    In the rfcomm chat sample, nothing related to bluetooth is released/disposed in the suspend event handler. At this point I am a bit confused.

    1)  Do I need to release device/service info related to bluetooth device in the suspension event handler?

    2)  Do I need to re-enumerate bluetooth device on resume?

    3)  Do I need to re-instantiate bluetooth device (via FromIdAsync()) on resume?

    4) Can I just kept a record of the device GUID on suspend, and use that GUID to re-instantiate BT device on resume? cuz i want the app to be able to reconnect the the previous selected device silently without user interaction.

    Cheers

    Fred

    Tuesday, May 20, 2014 3:42 AM

All replies

  • I'll ask our BT guys to take a look at this post.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, May 20, 2014 12:26 PM
    Moderator