I’m developing an application that performs periodic measurements (automatically, using AlarmManager) of heart rate and SpO2. The code responsible for these measurements is a Service that, upon initiation, launches a persistent notification and turns on the screen, allowing for accurate heart rate reading.
The application is functioning well in terms of performing periodic measurements. However, after a certain number of measurements (apparently not a standard number of times), the measurement process seems to get stuck in a sort of loop, where it doesn’t reach SpO2Status.MEASUREMENT_COMPLETED.
I’ve tried several methods to force termination after a specific time period and similar approaches, but without success. I would like to know how to work around this issue, or at least discover the reasons behind this problem.
Furthermore, I’m using two different smartwatches during my development: Samsung Galaxy Watch4 (Wear OS 3) and Samsung Galaxy Watch4 Classic (Wear OS 4), along with version 1.1.0 of the Samsung Health Privileged SDK.
I would be genuinely grateful if someone could assist me with this issue. Thank you in advance.
PS: The screenshot below is a snippet of what keeps appearing in the Logcat when the issue occurs.