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

Improve notification handling when app is in background or is closed #20

Open
devinbileck opened this issue Jun 6, 2022 · 0 comments
Open

Comments

@devinbileck
Copy link
Member

When the app is in the foreground, received notifications are processed by the FirebaseMessagingService onMessageReceived method and displayed within the app. However, when the app is in the background or is closed, received notifications are sent to the notification tray and it is necessary to click each one for it to be processed and displayed within the app.

It would be better if we could find a solution for which the onMessageReceived method is called whenever a notification is received regardless of the state of the app. That way we can guarantee that we persist the notification without having to click each one individually or in case the user dismisses the notification.

It is possible for onMessageReceived to be called while the app is in the background, see https://stackoverflow.com/a/39867458. However, it may not be possible while the app is closed.

One such improvement that I attempted but failed with was upon launching the app to process/persist all active notifications. That would at least eliminate the need to click on each notification, only on one of them. However, it is not possible to access the intent.extras content that way (which contains the encrypted message) - it is only accessible when launching the app from clicking on an individual notification.

Another idea that I had was if the app is running or in the background, we may be able to prevent the notification message from being shown in the notification tray and instead process the data message and then broadcast a notification showing the decrypted message content.

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

No branches or pull requests

1 participant