Skip to content

Fix/android ask every time permanently denied - #1559

Merged
mvanbeusekom merged 4 commits into
Baseflow:mainfrom
TetrixGauss:fix/android-ask-every-time-permanently-denied
Sep 4, 2026
Merged

Fix/android ask every time permanently denied#1559
mvanbeusekom merged 4 commits into
Baseflow:mainfrom
TetrixGauss:fix/android-ask-every-time-permanently-denied

Conversation

@TetrixGauss

@TetrixGauss TetrixGauss commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Replace this paragraph with a short description of what issue this pull request (PR) solves and provide a description of the change. Consider including before/after screenshots.

List at least one fixed issue.

Pre-launch Checklist

  • I made sure the project builds.
  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is does not need version changes.
  • I updated CHANGELOG.md to add a description of the change.
  • I updated/added relevant documentation (doc comments with ///).
  • I rebased onto main.
  • I added new tests to check the change I am making, or this PR does not need tests.
  • I made sure all existing and new tests are passing.
  • I ran dart format . and committed any changes.
  • I ran flutter analyze and fixed any errors.

TetrixGauss and others added 2 commits September 3, 2026 12:03
On Android 11+, selecting "Ask every time" in the app settings revokes the
permission as a one-time permission, which clears FLAG_PERMISSION_USER_SET.
shouldShowRequestPermissionRationale() then returns false, exactly as for a
permission that was never requested or one that is permanently denied. The
plugin combined that with a "was denied before" flag in SharedPreferences
that was never cleared, so `status` kept reporting permanentlyDenied even
though the OS would show the request dialog again (Baseflow#1206).

- A status check now always reports `denied` for a denied runtime
  permission; Android offers no API to tell the three states apart.
- `request()` resolves permanentlyDenied from the change of the rationale
  flag across the request (true -> false means the second denial), falling
  back to the stored flag when the OS resolved the request without a dialog.
- The stored flag is cleared whenever the permission is observed granted.
- Docs, README and changelogs updated; versions bumped.

Verified on an Android 16 emulator with the example app: the old build
reports permanentlyDenied after "Ask every time", the fixed build reports
denied and shows the dialog on the next request.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@TetrixGauss

Copy link
Copy Markdown
Contributor Author

@mvanbeusekom please review

@mvanbeusekom mvanbeusekom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR, I like the idea of no longer returning a permanently denied status from the permission check.

The changes look solid and I really like the "ANDROID_PERMANENTLY_DENIED_FIX_GUIDE.md". However I am missing a bit the advertisement of the guide. It would be a shame if nobody read the guide, because it cannot be found. To fix this, lets link the guide from the permission_handler/README.md and permission_handler/CHANGELOG.md files.

TetrixGauss and others added 2 commits September 4, 2026 10:59
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…nently-denied' into fix/android-ask-every-time-permanently-denied

# Conflicts:
#	ANDROID_PERMANENTLY_DENIED_FIX_GUIDE.md
@TetrixGauss

Copy link
Copy Markdown
Contributor Author

@mvanbeusekom please review again.

@mvanbeusekom
mvanbeusekom merged commit 90cedc2 into Baseflow:main Sep 4, 2026
3 checks passed
@TetrixGauss

Copy link
Copy Markdown
Contributor Author

Oh nice! Thank you @mvanbeusekom . i am a contributor now haha niceeee.

@mvanbeusekom

Copy link
Copy Markdown
Member

You sure are! Thanks a lot, credits to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants