We have written an electron app. It shows notifications (Win10). Once the app was spamming with a lot of notifications so I switched them off from the notification tile.
I wanted to enable them back. So I went to notification settings and I could not find my app in the list.
PS: We are using electron Notification module and we are also calling app.setAppUserModelId("OurAppName")
This is a semi-known issue where electron applications are simply missing from Windows Notifications Center.
Try changing
app.setAppserModelId("yourAppName");
To
app.on('ready', () => app.setAppUserModelId("Your.AppName"));
I had the same issue recently and this did the trick for me, I found the solution here:
https://github.com/Automattic/simplenote-electron/pull/2483
In other iterations of similar issues, there is a workaround to enable notifications again which can be found here:
https://github.com/electron/electron/issues/24330#issuecomment-650546142
For Electron you can find the event 'ready' here: https://www.electronjs.org/docs/api/app#event-ready
Related
I tried to use web-push with Electron + React, and got this error
DOMException: Registration failed - push service not available
I did everything according to this article
Does anyone have any ideas?
Electron doesn't support WebPush notifications out of the box, because this is not part of Chromium itself. More details here.
As an alternative solution, you can use Pushy (paid) or this beautiful library — electron-push-receiver. I am using electron-push-receiver myself and it works like a charm with Firebase Cloud Messaging.
In a previous answer regarding Notification Delegation between Chrome and an Android TWA app it was said that:
"If the TWA has notifications disabled in Android Settings, we disable
them in Chrome instead. There's a little bit of latency with how this
gets propagated, but things should get updated on the next TWA launch
at latest.
How exactly Notification Delegation does work?
On my site I am sending the user to androids app notification settings when I find that notifications are not allowed in the browser.
But upon the users immediate return, the changes are not propagated to Chrome (to be expected from the comment above since the TWA is not launched again).
I wonder if there is anyway I can speed this up? Otherwise the user is forced to exit the page completely and restart the app before the permission is granted, which is not a very good user experience.
It seems the only workaround would be to force restarting the application, which is not a great user experience. I have filed an issue on Chromium bugs to track a fix for this: https://bugs.chromium.org/p/chromium/issues/detail?id=1064300
I followed this guide to install react-native-onesignal in a my project (React native SDK):
https://documentation.onesignal.com/docs/react-native-sdk-setup
When the app is opened, I receive the notifications.
The problem is that I do not receive notification when my app is closed. I am reading docs from many days but I still couldn't figure out howto do it.
I have another question:
Do I need also to follow the doc about Android SDK? Or the first one I followed is enough?
To simplify my problem: I have an ecommerce app that uses geofencing to detect when to prepare an order:
BackgroundGeolocation.onGeofence(geofence => {
this.props.prepareOrder();
});
The thing is, prepareOrder() makes an HTTP request to my server. I've noticed that it doesn't actually make the request until my app is foregrounded.
Is there a way around this? It is very likely that my app is backgrounded when they enter the geofence and I need to make a request.
======
The more complex version is here: https://github.com/redux-saga/redux-saga/issues/816. I'm using redux-sagas and it doesn't seem like yield call is being called. But I'm not sure if it's a redux-saga thing or something with making HTTP requests in the background.
Same here... It's not a redux-saga problem, it's a more general problem with ReactNative apps working in background: the JS Thread appears to be frozen when app is in background for a long time (especially on iOS when screen is shut down)
the behavior is different between iOS & android, and also depends on OS version. Still, We're building an application that needs constant geolocation in foreground & background, we tried doing it with sagas and we saw it didn't work : we would stop receiving locations after some time. Watching at our logs, we would see that all the ReactNative logs we had would stop too. Hence our wild guess on "maybe the OS stops all the ReactNative context, for energy reasons
So we moved our background code into native :
HTTP POST in a custom RN Native Module when app is in background on iOS
Headless JS on android.
(it seems to be the solution others have chosen too, like https://github.com/mauron85/react-native-background-geolocation)
it works!
I'm working on a Windows app and integrated Toast notification in it. Paired with an AWS SNS service, it's working fine, I can successfully receive my notifications.
My notifications are used to fire events when the app is launched, it's not designed for final user. For this reason, I don't need any banner or display for these notifications: only handle the event in the app.
My issue is, when the app is killed, Windows displays a banner (top right corner) for any new notification. I found a way to disable banners directly in the OS, but I would like a solution when pushing the notification (backend side).
I already did it for iOS, kind of 'silent' notification, without any alert, sound or badge, but can still be handled by the OS.
I would like to know if there is any way to do that on Windows too? Like any extra arguments I missed or a dedicated template for that.
Thanks
I finally found a way to do that.
I changed from Toast notification to Raw notification (a push notification that does not involve UI). (MSDN - Documentation)
After that, I had to customise my AWS SNS notification wiht MessageAttributes to change the type of my WNS notification (AWS - Documentation).
I've also noticed that we can directly suppress the Toast UI on Windows phone with "X-WNS-SuppressPopup" param, which can be also very helpful. (MSDN - SuppressPopup).
Finally, inspired from AWS Baidu Push notification sample code, I did the same for WNS platform, adding all new arguments I needed, and it works great at the end.
Hope this can help someone else.