We are using Ionic 2 native push plugin.
Url :- https://ionicframework.com/docs/native/push/
pushObject.on(‘notification’).subscribe((notification: any) => alert(‘Received a notification’, notification));
pushObject.on(‘registration’).subscribe((registration: any) => console.log(‘Device registered’, registration));
pushObject.on(‘error’).subscribe(error => console.error(‘Error with Push plugin’, error));
What is working :-
When I send a push notification and the APP is already opened, show an alert modal with the text of notification.
What is not working:-
When I send a push notification and the APP is in background or closed, show the message in android notify. If I tap this notification, open the APP. Alert model not open. (on(‘notification’) isn’t trigged when app is in background or closed)
Note:- This is working in iOS.