Check if push is enabled on the device

Hi

I’m using the push plugin through ionic services as this describes http://docs.ionic.io/services/push/. I would like to know if the user enabled push on the device when implementing this.

Push is imported from ‘@ionic/cloud-angular’;

If I check the docs for push native it is imported from ‘@ionic-native/push’ and makes it possible for me to check it like this:

this.push.hasPermission()
.then((res: any) => {

if (res.isEnabled) {
  console.log('We have permission to send push notifications');
} else {
  console.log('We do not have permission to send push notifications');
}

});

However hasPermission() is not available through @ionic/cloud-angular, so I have no idea how to perform this check.

Any advice is much appreciated

I imagine it would be here this.push.plugin.hasPermission() :slight_smile:

1 Like

Uh so simple :slight_smile:

I had no idea I could call the plugin like that. Thanks a lot.