Notifications do not appear in Windows 10 Entreprise
Hello,
I'm trying to use your package in my custom application to display notifications. It is working fine on Windows 10 Professionnel but nothing appears when i run my application on Windows 10 Entreprise (The app runs without errors but does not display the notification)
Do you have any idea why it is not working on Windows 10 Entreprise ? Or if there is any dependencies that should be installed on windows to make it work.
Thank you
https://docs.microsoft.com/en-us/windows/whats-new/ltsc/ https://techcommunity.microsoft.com/t5/windows-it-pro-blog/ltsc-what-is-it-and-when-should-it-be-used/ba-p/293181
I guess the Windows Runtime API is different
Thank you for your quick answer.
Yes maybe the Windows Runtime API is different but i think it's more a dependency issue.
For example this package https://github.com/hallazzang/go-windows-programming/tree/master/example/gui/notifyicon is working fine with both windows environments which means that the APIs are the same i think.
The advantage of your package for me is that it's working correctly even if i run my application as a windows service (normally it should not because windows services can not interact with windows desktop) which is not the case for all other packages i tested even in other programming languages.
I will continue my investigation.
Thank you again.
https://github.com/hallazzang/go-windows-programming/tree/master/example/gui/notifyicon
This is a different implementation.
Can you try fyne-io/fyne?
If it can work, I think I can try to fix it.
// https://github.com/fyne-io/fyne/blob/7229e889d49c81a83b0b7e09400837f67f6ddad5/test/notification_test.go#L12-L20
func TestAssertNotificationSent(t *testing.T) {
n := fyne.NewNotification("Test Title", "Some content")
myApp := fyne.CurrentApp()
test.AssertNotificationSent(t, n, func() {
fyne.CurrentApp().SendNotification(n)
})
assert.Equal(t, myApp, fyne.CurrentApp())
}
I tried fyne-io/fyne and it is working fine in both windows environments.
Can you help me test it on Windows 10 Enterprise?
- Copy the following code and save the file as
toast.ps1
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
$APP_ID = 'test_AppID'
$template = @"
<toast activationType="protocol" duration="short">
<visual>
<binding template="ToastGeneric">
<text>test_title</text>
<text>test_message</text>
</binding>
</visual>
<audio silent="true" />
</toast>
"@
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($template)
$go_toast = New-Object Windows.UI.Notifications.ToastNotification $xml
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($APP_ID).Show($go_toast)
- Execute this command in
cmd.exe(please change the file path)
PowerShell -ExecutionPolicy Bypass "(Get-Content -Encoding UTF8 -Path D:\issues2\toast.ps1 -Raw) | Invoke-Expression;"
I tested this script in Windows Entreprise environment and it's not working. I got no error when executing the script but the notification does not appear.
Please delete this line and try again
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
$APP_ID = 'test_AppID'
$template = @"
<toast activationType="protocol" duration="short">
<visual>
<binding template="ToastGeneric">
<text>test_title</text>
<text>test_message</text>
</binding>
</visual>
-- <audio silent="true" />
</toast>
"@
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($template)
$go_toast = New-Object Windows.UI.Notifications.ToastNotification $xml
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($APP_ID).Show($go_toast)
I retested without this line and it still not working. I dont know if it can help but this PowerShell module https://github.com/Windos/BurntToast works fine in both environments
I've followed github.com/Windos/BurntToast, but I can't understand how it works
Please delete these lines and try again
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
-- [Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
-- [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
$APP_ID = 'test_AppID'
$template = @"
<toast activationType="protocol" duration="short">
<visual>
<binding template="ToastGeneric">
<text>test_title</text>
<text>test_message</text>
</binding>
</visual>
-- <audio silent="true" />
</toast>
"@
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($template)
$go_toast = New-Object Windows.UI.Notifications.ToastNotification $xml
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($APP_ID).Show($go_toast)
It still not working but this time it returns the below error (I'm sorry the error is written in french but to resume it can not find Windows.Data.Xml.Dom.XmlDocument ) :

Sorry, I'm still trying to figure out the differences with fyne-io/fyne
Please try again, if it still doesn't work, I'm sorry I may not understand how it works correctly
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
$APP_ID = 'test_AppID'
$template = @"
<toast activationType="protocol" duration="short">
<visual>
<binding template="ToastGeneric">
<text>test_title</text>
<text>test_message</text>
</binding>
</visual>
<audio silent="true" />
</toast>
"@
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($template)
$go_toast = New-Object Windows.UI.Notifications.ToastNotification $xml
--[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($APP_ID).Show($go_toast)
++[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("$APP_ID").Show($go_toast);
It still not working.
Thank you for your investigation. i think i will use github.com/Windos/BurntToast for my application.
Thank you again
Very sorry, I will keep an eye on github.com/Windos/BurntToast and try to fix it