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

Notification API do not work with Windows 10 16299.19 (fall creators update) #10864

Closed
GregorBiswanger opened this issue Oct 20, 2017 · 124 comments
Closed

Comments

@GregorBiswanger
Copy link

  • Electron version: 1.7.8
  • Operating system: Windows 10 16299.19 - latest update

Expected behavior

Create a desktop notifications.

Actual behavior

No notification.

How to reproduce

Try with yours https://github.com/electron/electron-api-demos

@robinwassen
Copy link
Contributor

I am also able to reproduce this with the following setup:

  • Electron version: 1.8.1
  • Windows 10 16299.19
  • Electron API demo application - neither of the Basic notification or Notification with image appears on the desktop or notification center.

Looking at the build changes they have poked around in notifications: https://changewindows.org/build/16299/pc

Other applications has successfully shown notifications in Windows 10 16299.19, both Windows Defender and a third party app.

@MarshallOfSound
Copy link
Member

For the record I've been on the fast insiders track all year and have never had this problem, I'm currently on 17017 and double checked, notifications still work perfectly fine.

I'd suggest y'all got a broke build in 16299, when you update out of that version I wouldn't be surprised if this starts working for you again.

@felixrieseberg
Copy link
Member

felixrieseberg commented Oct 25, 2017

First of all, 👋 Gregor! Lange nicht mehr gesehen!

Secondly, the notification API in Windows 10 remained fundamentally the same, so this isn't gonna be easy. Action Center is pretty unreliable though - and apparently, as I learned from the notification team a few days ago, things can fall apart all the time. I can also confirm the bug on 16299.19, but I'd like to make double-sure that this isn't on Windows.

I'll take a look at this.

As a short-term solution, electron-windows-notifications still works fine.

@felixrieseberg felixrieseberg self-assigned this Oct 25, 2017
@sidneys
Copy link
Contributor

sidneys commented Nov 1, 2017

I can reproduce this, neither of my apps show notifications in Windows 10 17025.

@adlk
Copy link

adlk commented Nov 2, 2017

Same here.

  • Win 10 Pro Version 1703 (Build 15063.674) notifications work fine by using window.Notification and electron-windows-notifications
  • Win 10 Enterprise Evalution Version 1709 (Build 16299.9) neither window.Notification nor electron-windows-notifications show notifications.

The second build is the official IE Testing VM already running the Fall Creators Update.

@felixrieseberg Is there something we can do to support you in any way?

@dustinsoftware
Copy link

Same, my app broke as well with Fall Creators update :(

@latoohey
Copy link

latoohey commented Nov 8, 2017

Macrium Reflect team says the update has restricted the number of apps that can register for notifications (link below). Not sure if this is related but I can confirm that in addition to my Electron app being able to send notification on a pre-Fall Creators Update computer and not a post fall update computer, my app also no longer shows in the "Get notifications from these senders list" after updating whereas it did before.

https://knowledgebase.macrium.com/display/KNOW7/Windows+10+Notifications+-+1709+Fall+Creators+Update

@levinunnink
Copy link

levinunnink commented Nov 8, 2017

Same problem here. Upgraded to the Fall Creators Update and no more notifications.

@qqj1228
Copy link

qqj1228 commented Nov 9, 2017

I have the same issue.
Notifications can't work on Windows 10 16299.19, but works fine on Windows 10 15XXX.
Electron version is 1.7.9 and 1.7.6
So I use showMessageBox instead of Notifications

@levinunnink
Copy link

Can anyone confirm that switching to electron-windows-notifications fixes the issue?

@adlk
Copy link

adlk commented Nov 14, 2017

@levinunnink at least not for me. I tried it directly with the nodeRT as well but without success (electron-windows-notification is built on nodeRT)

@levinunnink
Copy link

So right now there is no known way to get notifications working on Electron + Windows 10 16XXX? Seems like a major problem. It's certainly breaking my app big time. Is anyone working on this?

@latoohey
Copy link

As a not very satisfying workaround, I'm using a modified version of electron-toaster for 16XXX+ computers right now which creates a new browser window that looks, acts, and appears/disappears like a notification. But it would be really good to get access to native notifications back.

@levinunnink
Copy link

I think I found a fix! Calling app.setAppUserModelId(<my app id>) suddenly fixes my notifications.

https://electronjs.org/docs/api/app#appsetappusermodelidid-windows

Can anyone else confirm that this fixes the issue? If this works for everyone, the documentation seriously needs to be updated.

@JimminiKin
Copy link

@levinunnink setAppUserModelId Fixes the issue for me too, Thx !

@hacdias
Copy link

hacdias commented Nov 26, 2017

Same issue here.

@felixrieseberg
Copy link
Member

Quick question: Which appUserModelId are you using to fix this? Electron already calls app.setAppUserModelId(com.squirrel.${packageName}.${exeName}), but only if your app was pacakged as a Squirrel app.

@levinunnink
Copy link

@felixrieseberg We ship our app using electron-packager, I don't think we use squirrel. The app id I used was the one in package.json build.appId.

@latoohey
Copy link

That did it! Using app.setAppUserModelId and specifying the same id used in package.json got native notifications back up and running -- and the app also now shows up in the Windows "Notifications & actions" settings page. Thank you so much!

@MarshallOfSound
Copy link
Member

Somewhat related: #11331

@abardik
Copy link

abardik commented Dec 6, 2017

Thanks a lot! It works.

dustinsoftware pushed a commit to Faithlife/FaithlifeMessages that referenced this issue Dec 7, 2017
@samuelcarreira
Copy link

I cannot solve the problem 👎

Details:
Renderer code

const notification = {
        title: 'Basic Notification',
        body: 'Short message part'
}

const myNotification = new window.Notification(notification.title, notification)
myNotification.onclick = () => {
         console.log('Notification clicked')
 }

Main code:

...
app.setAppUserModelId("com.dev.name")
app.on('ready', () => {
...

Software:
Windows 10 Pro 1709 (16299.98 64bits)
Electron 1.7.9

@roelpaulo
Copy link

@Praveer1981, you could take a look at this:
https://electronjs.org/docs/api/app#appsetappusermodelidid-windows
and/or this:
#10864 (comment)
and/or this:
#10864 (comment)
and as stated here:
https://electronjs.org/docs/tutorial/notifications#windows

Please take some time to read back because some might work for you and sometimes not depending on the scenario you are in but for the most part, having the proper shortcut and GUID/appID when packaged or setting app.setAppUserModelId('some-identifier-here') works on all version of Windows. Cheers.

@m4heshd
Copy link

m4heshd commented Feb 11, 2020

Yup. Used that method since 2018. No trouble to this day.

@Praveer1981
Copy link

@roelpaulo Thanks for the guidance. I will check this hope it will solve my problem

@Praveer1981
Copy link

@roelpaulo I am still trying to fix the notification issue
I also cloned https://github.com/electron/electron-api-demos and found that the notification is not working here as well

@m4heshd
Copy link

m4heshd commented Feb 12, 2020

Did you try the method in my old comment that @roelpaulo tagged? I just tried it and works like perfectly. I discovered that method pretty much by chance and fortunately it has become a permanent solution. Setting the AppUserModelId is essential but it should just be your execPath. Show us your process. Also refer the first part of my comment - #10864 (comment)

@Praveer1981
Copy link

Praveer1981 commented Feb 12, 2020

@m4heshd Thanks for your comment. Yes, I tried what @roelpaulo mentioned. Could you please have a look on my code (which is not working )
#22061

@m4heshd
Copy link

m4heshd commented Feb 12, 2020

Your code won't work because It's not updated with the solution I explained on that comment. Add these lines on top of your code (right after app is created).

const path = require('path');
app.setAppUserModelId(path.join(__dirname, 'node_modules', 'electron', 'dist', 'electron.exe'));

Before you try this, you need to add a shortcut of that electron.exe to your start menu which is located at C:\Users\YOUR_USER_NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs. Just open that above mentioned path on explorer and drag and drop the electron.exe shortcut to Programs folder and try a notification.

@Praveer1981
Copy link

Praveer1981 commented Feb 12, 2020

@m4heshd I do not understand why do we nee to give electron.exe path.
We download the app from the microsoft store which automatically gets install in start menu->programs In this case how app.setAppUserModelId(path.join(__dirname, 'node_modules', 'electron', 'dist', 'electron.exe')); would be useful ?
During development we use script to install the app.

@Praveer1981
Copy link

@felixrieseberg It doesnot look like electron-windows-notification works

@roelpaulo
Copy link

@Praveer1981, I myself do not understand at first but it is the requirement that MS put on every app to have a proper shortcut and GUID in order for the notifications to work. As I understand as a whole, it is a requirement, not a code work-around.

@Praveer1981
Copy link

@felixrieseberg We ship our app using electron-packager, I don't think we use squirrel. The app id I used was the one in package.json build.appId.

build.appId is an electron-builder property not electron-packager as far as I can tell. I'm using electron-packager today and have not had notifications work on the built .exe file even with the app.setAppUserModelId('some-identifier-here')

@Kikketer Did you manage to get the solution/workaround ?

@electron-triage
Copy link

Thank you for taking the time to report this issue and helping to make Electron better.

The version of Electron you reported this on has been superseded by newer releases.

If you're still experiencing this issue in Electron 6.x.y or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.

I'm setting the blocked/need-info label for the above reasons. This issue will be closed 7 days from now if there is no response.

Thanks in advance! Your help is appreciated.

@electron-triage electron-triage added the blocked/need-info ❌ Cannot proceed without more information label Feb 19, 2020
@Praveer1981
Copy link

@electron-triage I have pushed the source code in my gitgub:
https://github.com/Praveer1981/electron-quick-start
I found that the Notification works well in Below machine configuration
OS Name Microsoft Windows 10 Pro
Version 10.0.18362 Build 18362
Other OS Description Not Available
OS Manufacturer Microsoft Corporation
System Name DESKTOP-9TCQVQ0
System Manufacturer Dell Inc.
System Model Inspiron 5570
System Type x64-based PC
System SKU 0810
Processor Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, 1992 Mhz, 4 Core(s), 8 Logical Processor(s)
BIOS Version/Date Dell Inc. 1.2.3, 15/5/2019
SMBIOS Version 3.0
Embedded Controller Version 255.255
BIOS Mode UEFI
BaseBoard Manufacturer Dell Inc.
BaseBoard Product 0YDF7T
BaseBoard Version A00
Platform Role Mobile
Secure Boot State On
PCR7 Configuration Elevation Required to View
Windows Directory C:\WINDOWS
System Directory C:\WINDOWS\system32
Boot Device \Device\HarddiskVolume5
Locale United States
Hardware Abstraction Layer Version = "10.0.18362.628"

However, It does not work in the PC which has below configuration
OS Name Microsoft Windows 10 Enterprise N
Version 10.0.17763 Build 17763
Other OS Description Not Available
OS Manufacturer Microsoft Corporation
System Name xxxxxxxx
System Manufacturer LENOVO
System Model 30BBS1430Q
System Type x64-based PC
System SKU LENOVO_MT_30BB_BU_Think_FM_ThinkStation P720
Processor Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz, 2295 Mhz, 12 Core(s), 24 Logical Processor(s)
Processor Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz, 2295 Mhz, 12 Core(s), 24 Logical Processor(s)
BIOS Version/Date LENOVO S04KT28A, 25-Jul-18
SMBIOS Version 3.0
Embedded Controller Version 18.29
BIOS Mode UEFI
BaseBoard Manufacturer LENOVO
BaseBoard Product 1037
BaseBoard Version SDK0Q40104 WIN 3305665676457
Platform Role Workstation
Secure Boot State On
PCR7 Configuration Elevation Required to View
Windows Directory C:\WINDOWS
System Directory C:\WINDOWS\system32
Boot Device \Device\HarddiskVolume1
Locale United States
Hardware Abstraction Layer Version = "10.0.17763.1007"

I have tried with below version of NODE
v10.13.0
v12.16.1

@Praveer1981
Copy link

Praveer1981 commented Feb 26, 2020

I managed to solve the problem in my real application:
I had to get the application Id from the AppXManifest.xml:
<Application Id="XXXXX">
main.js
const app = require("electron");
app.setAppUserModelId("XXXXX");

@HalasProject
Copy link

HalasProject commented Jun 1, 2020

I encountered the same problem I did not receive any notification in windows until I separated the notification call with the show() function like this

const {Notification} = require("electron");

var notif = new Notification({
        title:"APP NAME"
        body:"BODY HERE"
      })

      notif.show()

@Tepexic
Copy link

Tepexic commented Jun 11, 2020

I encountered the same problem I did not receive any notification in windows until I separated the notification call with the show() function like this

const {Notification} = require("electron");

var notif = new Notification({
        title:"APP NAME"
        body:"BODY HERE"
      })

      notif.show()

This worked for me. I also had setAppUserModelId set as well.

@xlzhou1
Copy link

xlzhou1 commented Jul 22, 2020

I encountered the same problem I did not receive any notification in windows until I separated the notification call with the show() function like this

const {Notification} = require("electron");

var notif = new Notification({
        title:"APP NAME"
        body:"BODY HERE"
      })

      notif.show()

This worked for me. I also had setAppUserModelId set as well.

Hey @Tepexic, can I know how do set the package.json? And what value did you pass into setAppUserModelId? Is it appId or process.execPath? Thanks

@xlzhou1
Copy link

xlzhou1 commented Jul 22, 2020

Your code won't work because It's not updated with the solution I explained on that comment. Add these lines on top of your code (right after app is created).

const path = require('path');
app.setAppUserModelId(path.join(__dirname, 'node_modules', 'electron', 'dist', 'electron.exe'));

Before you try this, you need to add a shortcut of that electron.exe to your start menu which is located at C:\Users\YOUR_USER_NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs. Just open that above mentioned path on explorer and drag and drop the electron.exe shortcut to Programs folder and try a notification.

Hey @m4heshd, I tried to use the method you mentioned, https://www.electronjs.org/docs/tutorial/notifications#windows. But I still can not get the notification. I used Windows 10.

autoUpdater.setFeedURL(feedUrl);
autoUpdater.on("update-available", (info: UpdateInfo) => {
    new Notification({
      title: "APP NAME",
      body: "APP BODY"
    }).show();
  });
  app.setAppUserModelId(process.execPath);
  return autoUpdater.checkForUpdates();

Can I know how to fix that?

@Tepexic
Copy link

Tepexic commented Jul 23, 2020

I encountered the same problem I did not receive any notification in windows until I separated the notification call with the show() function like this

const {Notification} = require("electron");

var notif = new Notification({
        title:"APP NAME"
        body:"BODY HERE"
      })

      notif.show()

This worked for me. I also had setAppUserModelId set as well.

Hey @Tepexic, can I know how do set the package.json? And what value did you pass into setAppUserModelId? Is it appId or process.execPath? Thanks

I did it manually, like this:
// Set id app.setAppUserModelId('com.example.AppNameHere')

I don't have anything special on the package.json, other than this:
"name": "app-name-here"

@xlzhou1
Copy link

xlzhou1 commented Jul 23, 2020

app-name-here

Gotcha, since I did not set the appId in the package.json. I set the appId in electron-builder.yml according to this tutorialhere.

I tried this code change, but it did not work for me. Can I know if I miss something? Thanks!

OS: Window 10
Electron: 7.0.0

app.setAppUserModelId("appId");
autoUpdater.on("update-available", (info: UpdateInfo) => {
    new Notification({
      title: "APP NAME",
      body: "APP BODY"
    }).show();
  });
return autoUpdater.checkForUpdates();

@nuochong
Copy link

me too

@nornagon
Copy link
Member

This issue seems to have become a dumping ground for a variety of notification-related issues on Windows, but I don't think the original issue is still relevant. I'm closing + locking this issue, if you're encountering problems using notifications on Windows, please open a new issue and fill out the template.

@electron electron locked as resolved and limited conversation to collaborators Jun 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests