I tried to implement the native Push notification, but when i build android app, i get
Class not found error.
25 764231 error EXCEPTION: Uncaught (in promise): Class not found
26 764231 error ORIGINAL STACKTRACE:
27 764232 error Error: Uncaught (in promise): Class not found
at s (http://192.168.0.20:8100/build/polyfills.js:3:8568)
at s (http://192.168.0.20:8100/build/polyfills.js:3:8391)
at http://192.168.0.20:8100/build/polyfills.js:3:8902
at t.invokeTask (http://192.168.0.20:8100/build/polyfills.js:3:14051)
at Object.onInvokeTask (webpack:///./~/@angular/core/src/zone/ng_zone.js?:229:37)
at t.invokeTask (http://192.168.0.20:8100/build/polyfills.js:3:13987)
at e.runTask (http://192.168.0.20:8100/build/polyfills.js:3:11411)
at i (http://192.168.0.20:8100/build/polyfills.js:3:8028)
28 764234 error Unhandled Promise rejection:, Class not found, ; Zone:, angular, ; Task:, Promise.then, ; Value:, Class not found,
I followed Ionic Push Notification - Android and iOS working to get Push notification.
I have installed according to http://ionicframework.com/docs/v2/native/push/
but not working.
here is the snippet of my code
import { Push } from 'ionic-native';
this.platform.ready().then(() => {
console.log('11111111');
let push = Push.init({
android: {
senderID: "xxxxxxx"
},
ios: {
alert: "true",
badge: false,
sound: "true"
},
windows: {}
});
push.on('registration', (data) => {
console.log("device token ->", data.registrationId);
console.log(data.registrationId);
});
push.on('notification', (data) => {
console.log('message', data.message);
let self = this;
if (data.additionalData.foreground) {
let confirmAlert = this.alertCtrl.create({
title: 'New Notification',
message: data.message,
buttons: [{
text: 'Ignore',
role: 'cancel'
}, {
text: 'View',
handler: () => {
self.nav.push(DetailView, {data: data});
}
}]
});
confirmAlert.present();
} else {
self.nav.push(DetailView, {data: data});
console.log("Push notification clicked");
}
});
push.on('error', (e) => {
console.log(e.message);
});
});
this is my system information:
Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.43
ios-deploy version: 1.8.6
ios-sim version: 5.0.9
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62