Ionic push notification doesn't work when app is closed


#1

I implemented Ionic push service in my application. But it just works when the app is opened or is in background. When I close the app, the device doesn’t receive any notification (Tested in android). My codes:

In app.js

  $ionicCloudProvider.init({
    "core": {
      "app_id": "..."
    },
    "push": {
      "sender_id": "...",
      "pluginConfig": {
        "ios": {
          "badge": true,
          "sound": true
        },
        "android": {
          "iconColor": "#343434"
        }
      }
    }
  });

In controller:

    $ionicPush.register().then(function(t) {
        alert(JSON.stringify(t));
        opt = {ignore_user: true};
        return $ionicPush.saveToken(t, opt);
    }).then(function(t) {
        alert('Token saved:', t.token);
    });

    $rootScope.$on('cloud:push:notification', function(event, data) {
        var msg = data.message;
        alert(msg.title + ': ' + msg.text);
    });

Any idea??