Closed TobiasTao closed 3 years ago
Did you request permissions to show notifications first? For example:
window.Notification.requestPermission()
i tried it:
Notification.requestPermission().then(status => {
console.log(status);
const n = new Notification('title', {body: 'notification body'});
});
but permission is 'denied':
how can i change it?
Oh, do you have notifications enabled in your tauri.conf.json
?
I have enabled all API features: https://github.com/TobiasTao/tauri-api-demos/blob/master/src-tauri/tauri.conf.json#L41
I have the same problem. The notification doesn't work in the osx build, but it works in dev mode.
@AlexanderShvaykin I have the same problem. Will you consider repairing this problem? It works on MAC, but it doesn't work on windows.
Unfortunately we need better info to reproduce the error. Seems like it only happens on some specific setups.
This is happening to me also:
thread 'main' panicked at 'failed to call RoInitialize: error -2147417850', C:\.....\winrt-0.4.0\src\rt\mod.rs:729:9
I am not a desktop developer, but my uneducated investigation shows this has to do with initialising the Window Runtime, and mod.rs specifies RO_INIT_MULTITHREADED. The error code returned leads me to search results with the error message "Cannot change thread mode after it is set". So perhaps we are trying to reinitialise WinRT in a multithreaded mode, whereas it was initialised as singlethreaded already?
This is absolutely uneducated tinkering, but I would like to assist to clear this up as it is preventing me moving forward. Any direction from the Rust and Windows experts is welcome.
I have a fix for this, I'll push it tonight.
When working with Push.js(https://pushjs.org/docs/introduction), the desktop notification will pop up but then in less than one second the window (both dev and prod) will crash.
Describe the bug I tried two methods to send a notification:
via js
result: nothing happened: no notificaions and no errors
via rust:
Finished dev [unoptimized + debuginfo] target(s) in 3.01s Running
target\debug\tauri-api-demos.exe
got notification with message 'Some("notification data")' thread 'main' panicked at 'failed to call RoInitialize: error -2147417850', C:\Users\tobiastao.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rust lib/src/rust\src\libstd\macros.rs:16:9 note: run withRUST_BACKTRACE=1
environment variable to display a backtrace error: process didn't exit successfully:target\debug\tauri-api-demos.exe
(exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)app:spawn Command "cargo" failed with exit code: 3221226505 +0ms
app:tauri (runner) ⚠️ [FAIL] Cargo CLI has failed +2ms
app:tauri Shutting down tauri process... +1ms error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[tauri]: running info
Operating System - Windows_NT(10.0.18363) - win32/x64 Microsoft Edge - 44.18362.449.0_neutral__8wekyb3d8bbwe
Node.js environment Node.js - 12.18.3 tauri.js - 0.11.0
Rust environment rustc - 1.45.0 cargo - 1.45.0 tauri-bundler - 0.9.1
Global packages NPM - 6.14.6 yarn - 1.22.4
App directory structure /.git /.idea /.vscode /dist /e2e /node_modules /src /src-tauri
App tauri.rs - 0.9.0 mode - embedded-server build-type - bundle CSP - default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline' distDir - ../dist/tauri-api-demos devPath - http://localhost:4200