How to process push notifications data when app is not running?

Category: windows phone push


master__pk on Mon, 18 Aug 2014 11:19:00

I want to ask how to process data that is being sent through notifications (toast/raw) i.e, how can I save those data in my local Sqlite DB when my app is not running? 

If I send toast notification with relative in-app navigation and some data as key value pair as parameters, when this notification is received by the user and user taps on that then I can process the data sent. But in case if user didn't tap on that notification then my data will not be saved. So I can resolve this problem?

I have read many answers like using Windows Runtime Component in your app and register your app with background task when raw notifications are received(sent through WNS). 

PS: I am using MPNS instead of WNS (as I am developing apps for WP8 also). And Raw notifications are suppressed by MPNS if app is not running. 

Please suggest solution to this problem. I have been searching for this problem from past two days and got no success.

Thanks in advance.


Eric Fleck on Mon, 18 Aug 2014 22:29:57

If you're using MPNS there is no way to get data from notifications the user did not act upon.

The only solution in that case is for your app to contact your server to get changes since the last time the app ran, and/or implement a ResourceIntensiveTask to periodically contact your server to get updates. 

Note: I recommend ResourceIntensiveTask because PeriodicTask may not have network access when it runs and may not get enough time to perform network call + Sqlite update.

master__pk on Tue, 26 Aug 2014 04:52:44

Then how does messenger like whats app are saving data when whatsapp is not running? Suppose a scenario : a message is received by user but at that time he/she didn't acted upon. Few minutes Later he/she got disconnected from internet then opens the messenger, he/she find his/her message saved in their whats app even the user didn't responded to that notification neither the app contacted the server as when opening the app there is no internet connection.

Then how the above scenario became possible??