Open souvickcse opened 4 years ago
Unable to send push notifiction to browser. For example
{ multicast_id: 3474356041305334000, success: 1, failure: 0, canonical_ids: 0, results: [ { error: null } ] }
I am getting this :
{ multicast_id: 3474356041305334000, success: 0, failure: 1, canonical_ids: 0, results: [ { error: 'InvalidRegistration' } ] }
Every time.
Add push functionality in ionic app:
import { Push, PushObject, PushOptions } from '@ionic-native/push/ngx'; pushObject; constructor( public alertController: AlertController, private push: Push, ) { } setupPush() { this.pushObject = this.push.init({ android: { }, browser: { pushServiceURL: 'http://push.api.phonegap.com/v1/push', }, ios: { alert: "true", badge: "false", sound: "true" }, windows: {} }); console.log("Push Init Called"); this.pushObject.on('registration').subscribe((data: any) => { console.log('device token -> ' + data.registrationId); }); this.pushObject.on('error').subscribe(error => console.error('Error with Push plugin' + error)); }
Firefox 77.0.1
cordova --version 9.0.0 (cordova-lib@9.0.1) cordova platform version browser 6.0.0
phonegap-plugin-push 2.3.0 "PushPlugin"
var gcm = require('node-gcm'); var sender = new gcm.Sender(firebaseKey); module.exports = { sendPush(deviceIds, title, body) { var message = new gcm.Message(); message.addNotification({ title: 'Alert!!!', body: 'Abnormal data access', icon: 'ic_launcher' }); // Actually send the message sender.send(message, { registrationTokens: deviceIds }, function (err, response) { if (err) console.error(err); else console.log(response); }); }, };
{ multicast_id: 1564376416527500000, success: 0, failure: 1, canonical_ids: 0, results: [ { error: 'InvalidRegistration' } ] }
Expected Behaviour
Unable to send push notifiction to browser. For example
Actual Behaviour
I am getting this :
Reproduce Scenario (including but not limited to)
Every time.
Steps to Reproduce
Add push functionality in ionic app:
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Firefox 77.0.1
Cordova CLI version and cordova platform version
Plugin version
Sample Push Data Payload
Sample Code that illustrates the problem