Push Notification are not worked when app was closed


#1

Hi all,
i’m just a newbie on IONIC 2 and wanna deal with Push Notification plugin.
In case app is opening, everything is worked very fine.
But about the case we closed the app, IMHO push notification’s subscribers will be dead… So how can I deal with it ?


#2

If your are app is not running, it can not handle anything.
When your app is later opened, it will be informed about what to handle - so handle it.


#3

So is there any way to auto increase the app’s badge when I received Push from server ?


#4

Yes, badge numbers can be changed - increased, decreased or removed. Your push provider should offer some documentation on that.


#5

Can you explain which Push Service do you use? OneSignal is the best way to handle Push notifications in my opinion.


#6

We used FCM and phonegap-plugin-push to work with notification.

When my app is running in background or be closed, It’s automatically insert message to system tray (notification bar), and badge numbers doesn’t change with number was sent from server.

Do you have any plugins else to deal with it ?


#7

Maybe this tutorial will help you out: https://ampersandacademy.com/tutorials/ionic-framework-version-2/push-notification-using-google-firebase

      } else {
    //if user NOT using app and push notification comes
    //TODO: Your logic on click of push notification directly
    //self.nav.push(DetailsPage, {message: data.message});
    console.log("Push notification clicked");
  }

It explains exactly what you need :slight_smile:


#8

Is there any solution? My app works fine and I get notification when the app is opened or working in background, but when I close it and send push notification from ionic push service, I can’t receive it.


#9

I’m using OneSignal and can’t show notification if the app are closed. Any solution for this?