B4J Question How to show system notification

Brandsum

Well-Known Member
Licensed User
In windows I can show a system notification from tray icon using this code,
B4X:
Dim jo As JavaObject = trayIcon
    jo.RunMethod("displayMessage",Array As Object("Hello, World", "notification demo", "INFO"))
upload_2019-3-12_1-54-31.png


But how can I do this in Mac OS?
 

Kiffi

Well-Known Member
Licensed User
Longtime User
In windows I can show a system notification from tray icon using this code,
B4X:
Dim jo As JavaObject = trayIcon
    jo.RunMethod("displayMessage",Array As Object("Hello, World", "notification demo", "INFO"))
sorry for Off-Topic, but I would like to display this notification under Windows. What kind of object is trayIcon?

Thanks in advance & Greetings ... Peter
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

Brandsum

Well-Known Member
Licensed User
See this answer: https://stackoverflow.com/a/34225861/971547

Should be simple to port it with jShell.
I've tried this. But in the notification, it's showing apple script icon instead of my application icon. How can I change that?

B4X:
Dim j As Shell
j.InitializeDoNotHandleQuotes("notify","osascript",Array As String("-e",$"display notification "New notification" with title "Title" sound name "Funk""$))
j.Run(-1)

I want to do this because ControlsUtils showNotification cant show notification while the app is in background.
 
Last edited:
Upvote 0
Top