Hi, Everyone!
I am using Ionic 3.20.0, Cordova 7.1.0, and I am trying to push notification using FCM.
When I test app in android emulator, it works fine, register device token, send and receive push notification exactly.
But in device, As soon as starting app, I get the following error “Error: SERVICE_NOT_AVAILABLE” and couldn’t get any push notification.
So, i tried to debug my code and found that pushObject.on(‘registration’) is not working properly so can’t subscribe the observable return.
// Registration not working
let seq = this.pushObject.on('registration').share();
// Don't go into this subscribe block
seq.subscribe((data: any) => {
console.log('device token -> ' + data.registrationId);
console.log('registrationType -> ' + data.registrationType);
}
Any advise will be appreciated, if anyone can point out what I am doing wrong with the Push plugin, please let me know…