krokyze / FitKit

Flutter plugin for reading health and fitness data. Wraps HealthKit on iOS and GoogleFit on Android.
BSD 2-Clause "Simplified" License
98 stars 73 forks source link

how to get current permission status #15

Closed pkc1672 closed 4 years ago

pkc1672 commented 5 years ago

I need to get current status at Fitness because need activate permission request button when permission canceled from outside . so, how can I get that?

krokyze commented 5 years ago

Hey, so this would work as expected only on Android GoogleFit, because iOS HealthKit in case user denies access still returns success. You can read more about this here: https://stackoverflow.com/a/56937166

In case your still interested, respond here and I will add it as a feature request.

nongtiny commented 3 years ago

I have a hacky way to check this.

We can check from the last year's read data. Health(iOS) still collects last year's records. So, if it returns an empty list then the permission is false, else it will be true.