I am not sure where to put the push notification logic in my app.
I have it working in the app.component.ts
now and it properly registers and receives the push id.
const pushObject: PushObject = this._push.init(new PushTools().parameters);
console.log(JSON.stringify(pushObject));
pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification));
pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', JSON.stringify(registration)));
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', JSON.stringify(error)));
However, I am not sure when/ where / how to handle the on(notification)
call. Depending on the type of notification a specific app iew should be opened. Should I rather put the notification into my main view and forward to the sub-views from there, i.e. implement on(notification)
in my main view than in app.component.ts
?
It works, but I wish the documentation was bit better and the workflow how a proper production state app should work.
Is there a good example how this can be implemented?
Thanks,
EL