So far all I have been able achieve is asking the user for permission to send them notifications & if they accept all that happens is that everytime they open the app they get a greetings notification, achieving that was not complicated because it was straight forward, I placed the code in my main.js script & it runs everytime the service worker gets registered.
*CODE:* Notification.requestPermission(result => { if (result === 'granted') { showNotification('Welcome to My App™', 'Everything Services™') } }); function showNotification(title, message) { if ('Notification' in window) { navigator.serviceWorker.ready.then(registration => { registration.showNotification(title, { body: message, tag: 'my-app', icon:'/init/static/images/icon_192x192.png', badge:'/init/static/images/icon_128x128.png', vibrate: [200, 100, 200, 100, 200, 100] }); }); } } On Monday, November 16, 2020 at 10:31:10 AM UTC+2 mostwanted wrote: > > Has anyone been able to implement push notifications on their web2py apps? > > I need a working application with some examples on how to implement this > for one of my applications. > > I've been looking at the "web-push-book ( > https://web-push-book.gauntface.com/how-push-works/)" but I cant put it > together in my head. > > What I wanna achieve is relatively basic, I have an applivcation that > offers information on services & products sold in my area, so what I want > is to be able to send notifications everytime a new service or product is > registered. > > If anyone has any idea on how I can easily implement this please help me. > > Regards; > > Mostwanted > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/01da1065-f7d3-4394-9014-a424639bef03n%40googlegroups.com.