I am using @ionic-native/push to receive push noti from my nodejs server.
This is my config:
Component.ts:
initPushNotification() {
const options: PushOptions = {
android: {},
ios: {
alert: 'true',
badge: true,
sound: 'false'
},
windows: {},
browser: {
pushServiceURL: 'http://push.api.phonegap.com/v1/push'
}
};
const pushObject: PushObject = this.push.init(options);
pushObject.subscribe('topic').then(() => {
console.log('subscribe success to topic')
}).catch((e) => {
console.log(e)
})
pushObject.on('registration').subscribe((data: any) => {
console.log('device token -> ' + data.registrationId);
//TODO - send device token to server
});
pushObject.on('notification').subscribe((notification: any) => {
console.log('Received a notification', notification)
});
pushObject.on('error').subscribe(error => console.error('Error with Push plugin' + error));
}
my app.modules.ts:
import { Push, PushObject } from '@ionic-native/push';
providers: [
...
Push, PushObject,
...]
An errors appear when I run android:
Uncaught Error: Can't resolve all parameters for PushObject: (?).
can anyone help me ?