[push] Store/do something - without user clicking notification, app in b/g


#1

Hi. I want to do something when the user receives a push message.
It works when the user clicks the notification, or the app is already open… NOT when the app is in the background.

I use the default phonegap-plugin-push according to the Ionic 2 documentation.
Probably, this is how it is supposed to work, but I want it to do more than this.

I want to store the received message (well, some additionalData anyway), but I can’t depend on the user clicking the notification or having the app open all the time.

Does anyone have this working already ? I tried tinkering with https://github.com/MobileChromeApps/cordova-plugin-background-app , but cannot get my head around using this in adjunction with Ionic 2, actually…


#2

Hi,

have you found a solution for this? I’m having the same dilemma…


#3

I ended up using Firebase messaging, it rocks.

When using Phonegap build though, you’d have to copy / fork the repository privately to be able to add the google-services.json and GoogleService-Info.plist to the plugin (last time I used it)

You can use .wasTapped to see if it was clicked or not and act upon it.