cph-cachet / flutter-plugins

A collection of Flutter plugins developed by CACHET
551 stars 681 forks source link

[Health 10.2.0] Unable to transition to Health Connect permission screen after tapping 'don't allow' twice #987

Closed bps-takumaodaki closed 4 months ago

bps-takumaodaki commented 5 months ago

Device / Emulator and OS

Describe the bug

When you tap 'don't allow' twice on the permission screen, you will no longer be able to display that screen. You can reproduce this issue with the example app by following these steps:

  1. Ensure Health Connect is installed but has not yet called requestAuthorization(), then launch the app.
  2. Tap the "Fetch Step Data" button and then tap "don't allow" on the permission screen.
  3. Repeat step 2.
  4. Tap the "Fetch Step Data" button.

→ The log shows "Access Denied (to Health Connect)!" and the permission screen will no longer be displayed.

Screenshots

https://github.com/cph-cachet/flutter-plugins/assets/111839744/54054f7f-40fd-4133-a43d-80d9ef9a5ca0

Additional information

After reproducing the issue, if you execute healthConnectClient.permissionController.revokeAllPermissions() and then execute requestAuthorization(), the permission screen will be displayed again.

CarlosCabarcos commented 4 months ago

If I am not mistaken, that is an Android expected behaviour. First time, they let you "try again", since it might have been a mistake. After denying a permission twice, the functions asking for a permisson and showing a dialog to allow or deny, won't do it any longer.

bps-takumaodaki commented 4 months ago

@CarlosCabarcos Indeed, it was written here. https://developer.android.com/about/versions/11/privacy/permissions#dialog-visibility

Considering that as the correct behavior, it might be good to call revokeAllPermissions() from the app if necessary.

Since this is the expected behavior, I'll close this issue.