Fix crash in LiveActivityFragment that was introduced by 2398dd0fb

This commit is contained in:
Arjan Schrijver 2024-10-16 22:18:56 +02:00
parent f9f3e8849b
commit 2618d54f94

View File

@ -367,8 +367,15 @@ public class LiveActivityFragment extends AbstractActivityChartFragment<ChartsDa
return;
}
try {
GBApplication.deviceService(getChartsHost().getDevice()).onEnableRealtimeSteps(enable);
GBApplication.deviceService(getChartsHost().getDevice()).onEnableRealtimeHeartRateMeasurement(enable);
} catch (IllegalStateException e) {
LOG.error("IllegalStateException catched, setting realtime tracking globally to {}", enable);
GBApplication.deviceService().onEnableRealtimeSteps(enable);
GBApplication.deviceService().onEnableRealtimeHeartRateMeasurement(enable);
}
if (enable) {
if (getActivity() != null) {
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);