Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(firebase_messaging, android)!: android 13 notifications permission request #9348

Merged
merged 11 commits into from Aug 24, 2022

Conversation

russellwheatley
Copy link
Member

@russellwheatley russellwheatley commented Aug 12, 2022

Description

PR checks if the app is running on android 13 and will check the app notification permissions. If none set or permissions not granted, a dialog box will appear requesting user notification permission.

I consider this a breaking change as there is certain configuration required such as targetSdkVersion & compileSdkVersion targeting android API 33.

Users will also need to have the android:exported="true" property set in app manifest on apps running on android 12 or higher.

Related Issues

closes #8720

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • 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

Does your PR require plugin users to manually update their apps to accommodate your change?

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

@russellwheatley russellwheatley changed the title feat(messaging, android)!: android 13 notifications permission request feat(firebase_messaging, android)!: android 13 notifications permission request Aug 12, 2022
@MarcinusX
Copy link
Contributor

@russellwheatley According to msackman's comment, I think we also need to update getPermissions() method to check for:

final boolean areNotificationsEnabled = ContextHolder.getApplicationContext().checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED;

@russellwheatley
Copy link
Member Author

@MarcinusX That makes sense. I'll update the PR 👍

Comment on lines +6 to +7
<!-- Permissions options for the `notification` group -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably mention this in the changelog for this PR

Copy link
Member Author

Choose a reason for hiding this comment

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

We can manually edit this when doing the next release I guess 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can change the squash message when merging from GitHub directly

@russellwheatley russellwheatley added plugin: messaging platform: android Issues / PRs which are specifically for Android. labels Aug 17, 2022
@firebase firebase locked and limited conversation to collaborators Sep 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform: android Issues / PRs which are specifically for Android. plugin: messaging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 [firebase_messaging] Add support for Android 13's POST_NOTIFICATIONS permission
5 participants