Using the Tray composable to displaying notificati...
# compose-desktop
j
Using the Tray composable to displaying notifications as described in this tutorial does not work for me on a Macbook running macOS Sonoma. I’ve checked in Notification setting of System Settings and verified that notifications were enabled for Intellij IDEA. The app doesn’t crash nor are any errors printed in the console. Does anyone have the slightest idea of what could be causing this issue?
s
We needed notifications for Briar, too. I'm not sure about the specific problems we encountered, but after checking lots of other solutions we implemented custom solutions for Linux, Windows and macOS, here's the macOS solution in particular: https://github.com/briar/briar-desktop/blob/main/briar-desktop/src/main/kotlin/org[…]t/briar/desktop/notification/macos/MacOsNotificationProvider.kt
j
Interesting… How exactly does this work? How are you selecting the MacOsNotificationProvider at runtime?
Also, I’m unfamiliar with Foundation.getObjcClass. Is this a custom reflection lib?
k
s
We have a simple method that checks the OS and returns the appropriate notifcation provider: https://github.com/briar/briar-desktop/blob/main/briar-desktop/src/main/kotlin/org/briarproject/briar/desktop/DesktopCoreModule.kt#L185
j
I took a peek around and came across your Desktop module already…
j
I’ve copied some code to through into a demo app.. I don’t get any errors but I’m not seeing notifications appear.
Is there a special registeration that needs to take place before you cal
MacOsNotificationProvider.sendNotification(…)?
s
No. Hmm, maybe something changed and things no longer work on Sonoma. Haven't checked our app on that version yet.
j
If you have an app on the AppStore I can give it a shot
s
it's not on the app store, but you can download it here: https://briarproject.org/download-briar-desktop/
a
I'm having the same issue with notifications on macOS. The exact code from the "Menu, tray, notifications" doesn't show any notifications. The notification settings are enabled. Is there any solution for this?
a
Could you submit a bug report on YouTrack?
z
if you still need something for notifications have a look at my small JNI lib. its what i use. its checked with ASAN and for linux there is a rust version of the JNI lib. https://github.com/zoff99/jni_notifications
614 Views