Recently built a Ionic 2 app using the latest version of Ionic, Cordova, Phonegap, etc. When sending push notifications my iOS devices receives and handles the notification fine, but my Android phone doesn’t. I’ve tested using a virtual device with Google API Android, and a live phone with version 7 running. Code below…
this.push.register().then((t: PushToken) => {
return this.push.saveToken(t);
}).then((t: PushToken) => {
console.log('Token saved:', t.token);
});
this.push.rx.notification()
.subscribe((msg) => {
// alert(msg.title + ': ' + msg.text);
let alert = this.alertCtrl.create({
title: msg.title,
subTitle: msg.text,
buttons: ['Dismiss']
});
alert.present();
});
Thoughts?
EDIT: Ionic Info
global packages:
@ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.3.0
System:
Node : v8.1.4
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : 1.9.1
ios-sim : not installed
npm : 5.2.0