Hi,
when tryng to send notifications with postpone the sample does not work. In fact, a notification is immediately shown.
Using google chrome Version 83.0.4103.61.
Thank you,
Luis
Hi Ruben,
meanwhile, I explored deeply, and in order to use Notification Trigger API, we have to enable #enable-experimental-web-platform-features at chrome://flags. When I did it, the scheduled notification presented in my last post has worked fine.
I have to congratulate Outsystems to the release of PWA. I have some questions about Outsystems PWA but this is not the forum for that.
Thank you and best regards,
I am very sorry, but after reading the code of this component I realized that the functionality send notification with postpone it is not a "schedule notification". Therefore it works, that is, a timestamp is shown in the local notification with the postpone time defined by me.
After implementin the code for the "Schedule Notification", I got the message from outsystems that the Notification Trigger API is not supported:
Is there any plans from outsystems to support this feature?
Hi Luis,
That appears to be a message from the browsers, not from the platform anyhow.
Can you provide some more details, or a sample page, to see how you're using it?
Thanks,
Cheers,
RG
Luis Barqueira wrote:
I created a PWA app with outsystems, and I am using the sample provided at
https://whatwebcando.today/scheduler.html
The code is presented next In OS I have used a Button that onclick call a JS node with the fuction schedulenotification(). For the JS code is included in Script as a file that is referenciated at the screen where the function is called.
HTML:
<p><button onclick="scheduleNotification()">Schedule notification in 10s<br>(using Notification Trigger API)</button></p>
JS:
function scheduleNotification() { if (!('Notification' in window)) { alert('Notification API not supported'); return; } if (!('showTrigger' in Notification.prototype)) { alert('Notification Trigger API not supported'); return; } Notification.requestPermission() .then(() => { if (Notification.permission !== 'granted') { throw 'Notification permission is not granted'; } }) .then(() => navigator.serviceWorker.getRegistration()) .then((reg) => { reg.showNotification("Hi there from the past!", { showTrigger: new TimestampTrigger(new Date().getTime() + 10 * 1000) }) }) .catch((err) => { alert('Notification Trigger API error: ' + err); });
When I run the app the message I get is the one I presented in the last post, i.e., "Notification Trigger API not supported".
Good to hear.
Just some notes for future reference:
If you have any question, regarding the component and it's usage, please let me know.
Best regards,