Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve bluethooth connection and rights request workflow for connected sensing devices (e.g. Polar Verity Sense) #200

Open
alireza-dhp opened this issue Nov 6, 2023 · 7 comments · Fixed by #253 or #258
Assignees
Labels
bug Something isn't working high priority

Comments

@alireza-dhp
Copy link
Member

When running the app on iOS for the first time,before logging via a token a popup message appears, requesting permission to use Bluetooth.

public

Upon denying the Bluetooth permission request, and after enter the token and accept the concept, the app encounters a failure and cannot proceed.

IMG_0013

@alireza-dhp alireza-dhp added bug Something isn't working high priority labels Nov 6, 2023
@smeddinck smeddinck changed the title Bluetooth Permission Request Issue on iOS Improve bluethooth connection and rights request workflow for connected sensing devices (e.g. Polar Verity Sense) Dec 6, 2023
@smeddinck
Copy link
Member

alsp improve the Polar integration interface in the Mobile App with all the error handling and proper feedback

may be important to implement better temporary locking in in the user interface, implement connection dialogue as a popup and also possibly integrate documentation for manual workarounds (e.g. connecting devices via system settings and only THEN adding them in MORE)

@smeddinck
Copy link
Member

Issues also exist in Android!

@andresgruber
Copy link
Contributor

Describe the different cases @alireza-dhp :

  • improve first connection with the polar verity sense
  • keep the collection alive - especially during a observation
  • provide proper methods of reconnection

@smeddinck
Copy link
Member

  1. Initial connection needs to make sure that appropriate OS rights requests are made. This procedure should be a triggerable process, since it can then be used for a "manual reconnect" procedure as a last-resort repair mechanism following programmatic and/or manual unlinking as much as possible (see below). The workflow and status signaling must be very clear to users and they should not be able to issue multiple simultaneous connection requests.
  2. If we are in a known observation period, i.e. data capture is expected to be active and the BT connection live, but it is not live, or no data is incoming: programmatic reconnect procedure in the background.
  3. After N automatic reconnects and/or X duration of "expected data not incoming" (best to keep such variables in config files), trigger a manual reconnect procedure as a last resort (include clear instructions to users).

@ja-fra
Copy link
Member

ja-fra commented Apr 15, 2024

We suggest the following workflow to handle the connections to external devices (Polar):

  1. On study-signup we offer to connect external devices on the "External Devices"-screen (if required by the study, as it is currently implemented)
  2. If the participant does not connect a device, the affected observations are marked with a ⚠-Icon
  3. Additionally, we'll show a ⚠-message on the top of the Dashboard.
  4. Both ⚠ take the participant to the "External Devices"-screen
  5. When an observation starts (should start) the app tries to (re-)connect to the external device. If this fails, the app will send a notification to the user.
  6. When the device disconnects while the observation is running, the app internally tries to reconnect. If this fails, the app will send a notification to the user.

@ja-fra ja-fra closed this as completed Apr 15, 2024
@ja-fra ja-fra reopened this Apr 15, 2024
janoliver20 added a commit that referenced this issue Apr 30, 2024
…plays and extended the Coroutine System to differentiate between app critical coroutines and study critical ones
janoliver20 added a commit that referenced this issue May 23, 2024
- Completely rebuilt the bluetooth core
- Implemented new pairing behavior
- Added error message capabilities for each observation
- Added the capability to open the bluetooth device connection view, when a device is not connected, directly from the task view or the error list view
- Added a new button to the schedule header which shows the amount of errors and opens a new page, which shows a list of all errors
- Fixed Threading issues
- General improvements
- Version Upgrades
janoliver20 added a commit that referenced this issue Jun 4, 2024
…the HR function needs a bit to activate and the framework returned immediatly an error

Also fixed an issue, where the permission dialog would immediatly pop up on the consent screen on Android
janoliver20 added a commit that referenced this issue Jun 5, 2024
…issues

#200: Fixed an issue where the Polar observation would not start, as …
@andresgruber
Copy link
Contributor

Improvements for bluetooth connection with Polar MORE-200

Primary use cases positively tested with App version 4.0.10 on iOS 17.5.1 (iPhoneSE)

  • First (clean) installation of the APP, bluetooth is on, polar is off -> login to a study with (hidden) polar observation -> after consent screen the devices screen opens with missing polar -> one can switch on polar and add to devices -> data fetch starts as soon as the observation starts (or has already started)

  • Manually stopping polar, while polar observation is running and app is in foreground or background -> notification sent to notification tab and error button appears on dashboard -> shows reason for the error -> sends one to the devices screen -> switching on polar automatically reconnects the polar device and resumes in collecting data

  • Manually stopping bluetooth, while polar observation is running and app is in foreground or background -> notification sent to notification tab and error button appears on dashboard -> shows reasons for the error (bluetooth and polar) -> sends on to the devices connection screen -> switching on bluetooth reconnects the polar device and resumes in collecting data

  • Manually stopping bluetooth and polar, while polar observation is running and app is in foreground or background -> notification sent to notification tab and error button appears on dashboard -> shows reasons for the error (bluetooth and polar) -> sends on to the devices connection screen -> switching on bluetooth -> screen stays and asks for polar -> switching on polar automatically reconnects the polar device and resumes in collecting data

Other cases positively tested

  • App is already installed and has been used, bluetooth is on, polar is on -> App closed and opened again -> Login with a new user > Polar gets automatically connected and starts collecting data

Cases with remaining issues or known limitations

  • App is already installed and has been used, bluetooth is on, polar is off -> App closed and opened again -> Login with a new user -> No notification nor error button appears -> closing the app and reopening solves the issue > switching on the polar devices -> does not automatically reconnect -> manually connecting the device is necessary -> collecting data resumes.
  • There will be no notification if the app is closed in case polar is disconnected.

@alireza-dhp
Copy link
Member Author

Dear @andresgruber,

I have tested the improvements made to the Bluetooth connection and found that it works significantly better than before. Thank you for the enhancements.

  • Devices used for testing:
    • iPhone SE (2nd generation), iOS version 17.5.1
    • Google Pixel 3a XL, Android version 12

There are some issues that I observed:

  • iOS and Android:

    • Data capturing does not start automatically when the app is running in the foreground/background and the Polar device is connected. Instead, automatic data capturing only begins immediately after a successful connection to the Polar device.
      So, if there is an upcoming polar observation and the participant connects the Polar device, data capturing does not start automatically, and the participant must initiate it manually.
      If this is intended behavior, why is it necessary to connect the Polar device immediately after signing up the participant?
    • The device connection error message should not appear when there are no upcoming Polar observations scheduled.
  • Android:

    • It would be better to anchor the capture data button and error message label to the bottom of the page.
      Image
  • iOS:

    • The error message is unreadable on the Polar observation page.
      Image
    • Sometimes the error message is displayed even when the device is connected.
      Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment