Android not receiving push notifications


#1

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

#2

Do you get tokens on Android?


#3

Yes, can verify that the Android devices are saving tokens.


#4

And if you send a push to that token (what backend do you use?) it doesn’t arrive at the phone, even not when the app is closed?


#5

I haven’t tried to send it to the specific token, but I am using the Ionic Push service. And the devices aren’t receiving notifications from any state of the app. I’ve built a blank app, only adding the iOS and Android platform, and the push plugin. And I have the same issue.