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

[Bug]: The INotificationClickListener does not work on HMS devices after the migration to OneSignal SDK v5.1.5 #2020

Open
1 task done
gabrielvrebac opened this issue Mar 7, 2024 · 1 comment

Comments

@gabrielvrebac
Copy link

gabrielvrebac commented Mar 7, 2024

What happened?

After migrating from OneSignal SDK v4.8.6 to v5.1.5, the OneSignal.Notifications.addClickListener no longer works on Huawei (HMS) devices when clicking on a push notification.

I also checked out the OneSignal example code and overwrote the following to send a push via our OneSignal project:

  • applicationId in the "app/build.gradle"
  • "google-services.json" (for GMS)
  • "agconnect-services.json" (for HMS)
  • OneSignal appId in the "MainApplication.java"

The push notification arrives on GMS and HMS. However, the INotificationClickListener only works on GMS but not on HMS.
The implementation of "INotificationServiceExtension" (here) does not work with HMS either.

Steps to reproduce?

1. Checkout the [OneSignal example project](https://github.com/OneSignal/OneSignal-Android-SDK/tree/main/Examples/OneSignalDemo)
2. Upgrade the Gradle plugin to v8.2.2 in Android Studio via `Tools > AGP Upgrade Assistant ...`
3. Update the agconnect classpath (`com.huawei.agconnect:agcp`) in the "build.gralde" from `1.6.2.300` to `1.9.1.303`
4. Update the Huawei push dependency (`com.huawei.hms:push`) in the "app/build.gradle" from `6.3.0.304` to `6.12.0.300`
5. Install the Huawei variant on an HMS device
6. Send a push and click on the push notification

What did you expect to happen?

After clicking on the push notification on a HMS device, the INotificationClickListener, which is set in the MainApplication (here), should be triggered and the log should contain the following output "INotificationClickListener.onClick fired with event: com.onesignal.notifications.internal.NotificationClickEvent@3e09b8f"

OneSignal Android SDK version

Release 5.1.5

Android version

12

Specific Android models

HUAWEI P40 lite

Relevant log output

############################## GMS ##############################
2024-02-27 18:11:32.353 27112-27112 sdktest                 D  OneSignal SDK initialized
2024-02-27 18:11:32.721 27112-27157 sdktest                 V  IRemoteNotificationReceivedHandler fired with INotificationReceivedEvent: com.onesignal.notifications.internal.NotificationReceivedEvent@ccb3334
2024-02-27 18:11:38.709 27112-27112 sdktest                 D  Privacy consent required set: true
2024-02-27 18:11:38.747 27112-27112 sdktest                 V  INotificationClickListener.onClick fired with event: com.onesignal.notifications.internal.NotificationClickEvent@3e09b8f

############################## HMS ##############################
2024-02-27 18:15:26.823 17117-17117 sdktest                 D  OneSignal SDK initialized
2024-02-27 18:15:26.931 17117-17117 sdktest                 D  Privacy consent required set: true

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jkasten2
Copy link
Member

jkasten2 commented Mar 7, 2024

@gabrielvrebac Thanks for reporting!

We were able to reproduce a problem with HMS push not firing INotificationClickListener as well.

On your 2nd question, the INotificationServiceExtension only works for HMS pushes if you use huawei_msg_type as "data". OneSignal set this to "message" by default as the reliability is lower for the "data" message type, due to limitations of HMS Core on the device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants