Skip to content

feat(messaging,android): improve how messaging is determining permission on Android - #18101

Open
Lyokone wants to merge 7 commits into
mainfrom
feat/17390
Open

feat(messaging,android): improve how messaging is determining permission on Android#18101
Lyokone wants to merge 7 commits into
mainfrom
feat/17390

Conversation

@Lyokone

@Lyokone Lyokone commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Description

On Android 13+, getNotificationSettings() now correctly returns notDetermined when the user has never been prompted. Previously it always returned denied, making it impossible to distinguish from a permanent denial.

Uses shouldShowRequestPermissionRationale() + SharedPreferences (same approach as permission_handler) to break the ambiguity. iOS/macOS/web unchanged — they already handled this correctly.

Related Issues

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@Lyokone
Lyokone force-pushed the feat/17390 branch 2 times, most recently from 2fe1422 to ae2cfa3 Compare August 3, 2026 08:00
Use PackageManager permission flags instead of SharedPreferences so soft
deny, permanent deny, and never-asked are distinguished correctly even when
another plugin requested POST_NOTIFICATIONS. Add AuthorizationStatus.deniedPermanently
and reset Android 13+ e2e permission state between tests.
Lyokone added 2 commits August 3, 2026 10:17
Getters are not valid inside the group() callback body, which broke
dart analyze in the tests package.
…form APIs

PackageManager.getPermissionFlags() and the FLAG_PERMISSION_USER_SET /
FLAG_PERMISSION_USER_FIXED constants are @hide/@Systemapi and are not part of
the public SDK at any API level, so the plugin failed to compile.

Resolve the status with public API instead: shouldShowRequestPermissionRationale()
plus a SharedPreferences record of whether the prompt was ever shown. The flag is
written when the permission is requested rather than only on denial, so a grant
followed by a revoke from system settings still reports deniedPermanently.

Also clear that record from the e2e permission reset helper so "never asked" is
reproducible across tests, and fix a google-java-format violation.
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.

✨ [firebase_messaging] check permission status

2 participants