PushNotificationPermission should also consider the NotificationChannel state to determine whether a notification can be sent.
Before opening, please confirm:
- [x] I have searched for duplicate or closed issues and discussions.
Language and Async Model
Kotlin
Amplify Categories
Notifications
Gradle script dependencies
// Put output below this line
dependencies {
implementation(libs.aws.android.sdk.mobile.client)
implementation(libs.aws.android.sdk.pinpoint)
implementation(libs.amplify.analytics.pinpoint)
implementation(libs.amplify.auth.cognito)
implementation(libs.amplify.push.notifications.pinpoint)
}
Environment information
I don't think it matters.
# Put output below this line
------------------------------------------------------------
Gradle 8.7
------------------------------------------------------------
Build time: 2024-03-22 15:52:46 UTC
Revision: 650af14d7653aa949fce5e886e685efc9cf97c10
Kotlin: 1.9.22
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 17.0.11 (Homebrew 17.0.11+0)
OS: Mac OS X 14.5 aarch64
Please include any relevant guides or documentation you're referencing
https://docs.amplify.aws/gen1/android/build-a-backend/push-notifications/set-up-push-notifications/
Describe the bug
I would like to use PushNotificationPermission, but this does not seem to include the decision whether the notification channel is enabled.
Reproduction steps (if applicable)
No response
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
amplifyconfiguration.json
No response
GraphQL Schema
// Put your schema below this line
Additional information and screenshots
No response
Hi @TBSten. I'm a little bit unclear what you'd be looking for this class to do - could you elaborate on what you're expecting in more detail? Thanks!
@mattcreaser
Sorry...
The documentation states that was able to get the sendability of Push notifications with the function Notifications.Push.getPermissionStatus(), but such a function was not included in the library artefact (search on Github).
So I was looking for an alternative function and found PushNotificationPermission. I thought that by using the hasRequiredPermission field of this class, I could get the ‘Permission to send Push notifications’ that I wanted to achieve with Notifications.Push.getPermissionStatus().
However, the current implementation of this class does not take the notification channel into account, so it may not check it correctly in some cases.
If there is an alternative function to Notifications.Push.getPermissionStatus(), I would like to know!
@TBSten Thank you for the context. It looks like our documentation is wrong in suggesting a method that doesn't exist. We will get back to you on your questions and correct the documentation as soon as we have a researched response for you.