Push Notification Not Shown when App is OPEN - Android

Hi guys!

Wondering if some of you had a problem with this. I am using full push notifications in Ionic with the phonegap-plugin-push.

Testing on Android when my app is closed/background my notification displays flawlessly but when I am using the app and I send a notification nothing is shown :confused:

Any chances someone could know what cloud be?

The cURL instruction is this one:

curl -X POST -H “Authorization: Bearer QWERTY123QWERTY123QWERTY123QWERTY123QWERTY123QWERTY123QWERTY123QWERTY123QWERTY123” -H “Content-Type: application/json” -d ‘{
“tokens”: [“QWERTY123QWERTY123QWERTY123QWERTY123QWERTY123”],
“profile”: “QWERTY123”,
“notification”: {
“title”: “Hi”,
“message”: “Hello world!”,
“android”: {
“title”: “Title!”,
“message”: “Message!”
}
}
}’ “https://api.ionic.io/push/notifications

TY guys!

Me too have this same problem…:confused:

You can use ionic popup to show notification. Like that
"onNotification": function(notification) {
var alertPopup = $ionicPopup.alert({
title: “Notification”,
template: notification.text,
buttons: [
{
text: ‘OK’,
}]
});

      }

ok ihuseynoff. I will try this one.:slight_smile:

TY very much ihuseynoff works like a charm! Kudos!

Hi ebocic/ihuseynoff. Excited to try the code. Where should I put it? On the “Ionic.Push” object?

Nevermind…it works!

Here’s what i did:

var push = new Ionic.Push({
      // "debug": false
      "onNotification": function(notification) {
          console.log(JSON.stringify(notification));
          var alertPopup = $ionicPopup.alert({
              title: notification._raw.title,
              template: notification._raw.message,
              buttons: [{
                  text: 'OK',
              }]
          });
      }

    });