I've implemented web push notifications for my Angular app using the SwPush component.
Now I've got a similar problem as question Changing application server key in push manager subscription
How do I refresh the subscription when my application server key has changed? Which boils down to:
How do I get the current subscription using SwPush in Angular?
I tried this:
this._swPush.subscription
.pipe(take(1))
.subscribe(pushSubscription => {
if (pushSubscription) {
console.log('Active subscription', pushSubscription) // never gets called
}
else {
console.log('No active subscription')
}
}, err => { console.log("swpush.subscription error", err); })
But when entering the app the call never returns if there has been an active subscription.