I\'m trying to make a simple app that should display notification when button is clicked. The problem is that the notification does not show, but console.logs are showing. S
I've got it working now, thanks to all the people here :) https://github.com/mikaelbr/node-notifier/issues/144#issuecomment-319324058
Based on anthonyraymond
's comment, you need to have your app INSTALLED
in your windows machine with an appId. You can configure appId
in your package.json
like this.
{
"name": "myapp",
"version": "1.0.0",
"description": "test",
"main": "main.js",
"build": {
"appId": "com.myapp.id"
}
}
The appId
does not need to have that java/android
format, my app just have an appId
of elite-notifier
.
Then you can pass the appId
when calling the notify
function of notifier.
notifier.notify(
{
appName: "com.myapp.id", <-- yes, the key here is appName :)
title: "Hello",
message: "Hello world!",
wait: true
},
function(err, response) {
// Response is response from notification
console.log("responded...");
}
);
After installation, This will work even on development mode (by running electron .
command) provided that you'll not change the appId
of your app after installation since there will be a mismatch on the installed one and the development version of the app.