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] Azure Communication first chat notification gets lost when app is in killed state #1480

Open
Calfredop opened this issue Dec 5, 2023 · 2 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@Calfredop
Copy link

Calfredop commented Dec 5, 2023

Describe the bug
When the app is killed from the Android device task manager, the first chat notification received from Azure Communication Services cannot be shown in any way.

What seems to happens is that when the app gets killed so it does the service extending the FirebaseMessagingService. In normal situations, when an app implementing FirebaseMessagingService is in killed state, the Firebase SDK generates a notifications for the app, using the payload, without triggering the onMessageReceived.
This is not the case with Azure Communication Chat notification, since the payload is data only and it's encrypted. For that, the Firebase SDK cannot create a standard notification and since the app is still not running (so neither is the FirebaseMessagingService), no notification can be shown to the user.
Once the app has finished starting, the next notifcations payload can go through the decryption/notification flow descripted here.

I could not find any solution to this, because I cannot manipulate the payload before it gets to device, and the device cannot handle it if the app is not up and running.

Exception or Stack Trace
No stacktrace generated by this issue.

To Reproduce
Steps to reproduce the behavior:

Setup the app with the needed libraries to use azure-communication-chat:2.0.1.

Setup push notifications in Android app as described in the Azure Communication Services official documentation.

Verify that the notification flow works when app is running, by sending messages to user bound to the ChatClient generated by the app.

Kill the app and try to send messages to the same user/ChatClient, to verify that the onMessageReceived is not triggered until the app is running and that Firebase SDK do not generate any notification.

Code Snippet
This is an example of Azure Communication Services Chat notification payload that cannot be processed by Firebase SDK:

{"eventId":200, "e": "cCxQh449Xy5qkQ15RYcMfcP5FvTMVeTiolsWVbBfKIZ83V8kEKdIydd42bKddBK7uUR8FFt5eWTfzGbXki0Do7cataG3i3AHMnGzWYzWZk3q15mwgh4..."}

Expected behavior
If the app is in killed state the notification should still pop, given a correctly formed payload.

Screenshots
Not applicable.

Setup (please complete the following information):

  • OS: Android (12, 13, 14)
  • IDE : Android Studio
  • azure-communication-chat:2.0.1
  • azure-communication-common:2.0.0-beta.2
  • com.google.firebase:firebase-messaging:23.3.1

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [ x ] Bug Description Added
  • [ x ] Repro Steps Added
  • [ x ] Setup information Added
@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Dec 5, 2023
@Maartinsh
Copy link

Did you ever figure it out?

@Calfredop
Copy link
Author

Did you ever figure it out?

No the problem resides here "since the payload is data only and it's encrypted". So on the app side there is nothing we can do. The issue is now almost 7 months old so I guess that's a trade for using this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

2 participants