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

Feature request: Adding a way to update sticky notification text without stopping and restarting that notification #2407

Open
leaf-node opened this issue Sep 19, 2024 · 5 comments · May be fixed by #2481
Labels
help wanted Extra attention is needed

Comments

@leaf-node
Copy link

stopForegroundService and startForegroundService can be used to update the text in a foreground service (sticky) notification in Android. However, that OS is slow to show newly created foreground services notifications (Maybe 10 - 20 seconds at times). It would be great if there were a way to change the title and body text without removing the current sticky notification.

I tried using second invocation of startForegroundService after the first invocation created the sticky notification, but that did not change the text.

@MaikuB
Copy link
Owner

MaikuB commented Oct 13, 2024

Could you help look into and submit a PR on this? Support for foreground service notifications was a contribution from the community that started with https://github.com/MaikuB/flutter_local_notifications/pulls?q=is%3Apr+is%3Aclosed+foreground

@MaikuB MaikuB added the help wanted Extra attention is needed label Oct 13, 2024
@leaf-node
Copy link
Author

I'm not sure when, but I'll take a look and see what I can do.

@Levi-Lesches
Copy link
Contributor

@leaf-node, it seems from this SO answer that the standard way to update a notification created by a foreground service... is to just send a new notification with the same ID.

Can you try using the same ID you did in createForegroundService to call show() the standard way, and confirm that it changes your notification?

@leaf-node
Copy link
Author

Can you try using the same ID you did in createForegroundService to call show() the standard way, and confirm that it changes your notification?

I can confirm that works. Thanks for your help with research. : )

@Levi-Lesches
Copy link
Contributor

Glad I can help! Let's leave this open for now and I will open a PR to improve the docs, since they explicitly suggest doing otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants