-
Notifications
You must be signed in to change notification settings - Fork 598
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
Push Notifications: Android 13 requires POST_NOTIFICATIONS permission #1135
Comments
I found out that a corresponding issue already exists for local notifications: #1116 |
The link below explains best practices on how new apps (Android 13+) should use this feature (for your reference). The corresponding Capacitor docs for the plugin might need to be updated as well.. https://developer.android.com/develop/ui/views/notifications/notification-permission#new-apps |
as a workaround, I created a simple capacitor plugin that can be used for obtaining POST_NOTIFICATIONS permission on android: https://github.com/hermitdemschoenenleben/capacitor-plugin-android-post-notifications-permission |
just tried your plugin @hermitdemschoenenleben error: cannot find symbol What does this mean I wonder ? |
fixed by
in variables.gradle |
Still doesn't work, Im running latest Ionic @caoacitor/push-notifications plugin and it doesnt ask for notifications when opening app, however it only asks weirdly on second app open immediately (preferably should ask after toggle my enable notifications button, like on IOS - not at beginning of app open) |
Without this plugin, we are also getting the prompt on second app launch. According to ionic team, they should get it on first app launch. I wonder how this is done? |
I think on older SDKs you get it on the first app launch after you've initialized push messages – which is typically the second app launch. |
I'm not getting the request for permission until after the first push notification is received while the app is backgrounded. This results in the first push being lost. I have targetSdkVersion = 32. |
Having same issue here as @indiebloom, after second launch while app is in background notification permissions prompt shows up, even though I have implemented the actual permission check as a result of the user pushing a button to enable notifications, like this: let permStatus = await PushNotifications.checkPermissions();
if (permStatus.receive === 'prompt') {
permStatus = await PushNotifications.requestPermissions();
} I would like for it to ask for permissions when calling |
I got help in the Capacitor discord to install the Capacitor 5 beta and that made notifications work! |
this was fixed in @capacitor/push-notifications 5 alpha 1, can be installed using capacitor 5 and check the capacitor 5 upgrade guide (it's still in beta) |
tried to update to the beta version (both capacitor and the capacitor plugin) and it actually works again and asks for permission. I'd like to know if they will fix it in capacitor 4, because i dont want to rush updating my apps |
no, it won't, this is a breaking change, so can't be backported. |
I see. |
No, you are not wrong, if you target SDK 32 then you don't need to request the push notification permission yourself, but you can't control when it will be requested, it's usually requested when you or a plugin creates a notification channel, but in some devices it can happen on next app launch after a channel was created. Main reason of Capacitor 5 to exist is to properly target SDK 33. It will support same iOS and Android versions Capacitor 4 supports, so should be an easy update. |
Thank you so much for your excellent explanation. |
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out. |
Feature Request
Plugin
push-notifications
Description
As Android 13 was released yesterday, I noticed that it requires that the user grants the runtime permission
POST_NOTIFICATIONS
before a user may receive push messages. Am I right that the capacitor push-notifications plugin doesn't implement this yet? As far as I know,requestPermissions()
only does something on ios, but not on android.More Info: https://firebase.google.com/docs/cloud-messaging/android/client#request-permission13
Platform(s)
Android 13
Preferred Solution
requestPermissions()
should ask forPOST_NOTIFICATIONS
on Android 13.The text was updated successfully, but these errors were encountered: