android / health-samples

Apache License 2.0
244 stars 138 forks source link

Prevent crash when starting an exercise #231

Closed amankhoza closed 4 months ago

amankhoza commented 4 months ago

Screenshot 2024-02-26 at 11 41 07

If an exercise is started with incorrect permissions or location is disabled and it is being requested, WHS throws an exception, this was not being handled in HealthServicesRepository which resulted in a crash when calling startExercise. This change catches the error and displays it in an error screen.

Implemented in ExerciseScreen to avoid having to reimplement the error catching logic since starting an exercise is called from multiple places.

amankhoza commented 4 months ago

@yschimke Have updated screenshot in PR description (reused Horologist AlertDialog component) and addressed comments.