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

Notifications do not appear in Windows 10 Entreprise #2

Open
younes199511 opened this issue May 21, 2022 · 13 comments
Open

Notifications do not appear in Windows 10 Entreprise #2

younes199511 opened this issue May 21, 2022 · 13 comments

Comments

@younes199511
Copy link

younes199511 commented May 21, 2022

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

Capture

@younes199511
Copy link
Author

younes199511 commented May 21, 2022

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.

@electricbubble
Copy link
Owner

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())
}

@younes199511
Copy link
Author

younes199511 commented May 21, 2022

I tried fyne-io/fyne and it is working fine in both windows environments.

@electricbubble
Copy link
Owner

electricbubble commented May 22, 2022

Can you help me test it on Windows 10 Enterprise?

  1. 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)
  1. 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;"

@younes199511
Copy link
Author

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.

@electricbubble
Copy link
Owner

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)

@younes199511
Copy link
Author

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

@electricbubble
Copy link
Owner

electricbubble commented May 23, 2022

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)

@younes199511
Copy link
Author

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 ) :

image

@electricbubble
Copy link
Owner

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);

@younes199511
Copy link
Author

It still not working.

Thank you for your investigation. i think i will use github.com/Windos/BurntToast for my application.

Thank you again

@electricbubble
Copy link
Owner

Very sorry, I will keep an eye on github.com/Windos/BurntToast and try to fix it

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

2 participants