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

PushNotificationPermission should also consider the NotificationChannel state to determine whether a notification can be sent. #2975

Open
1 task done
TBSten opened this issue Jan 16, 2025 · 3 comments
Labels
Push Notifications Related to the push notifications category question General question

Comments

@TBSten
Copy link

TBSten commented Jan 16, 2025

Before opening, please confirm:

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

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Jan 16, 2025
@mattcreaser
Copy link
Member

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!

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Jan 16, 2025
@mattcreaser mattcreaser added pending-community-response Issue is pending response from the issue requestor question General question Push Notifications Related to the push notifications category and removed pending-triage Issue is pending triage labels Jan 16, 2025
@TBSten
Copy link
Author

TBSten commented Jan 17, 2025

@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!

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Jan 17, 2025
@tylerjroach
Copy link
Member

@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.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Push Notifications Related to the push notifications category question General question
Projects
None yet
Development

No branches or pull requests

3 participants