How to save Toast notifications to local database in windows phone 7?
I am new to Windows phone 7 Push Notifications. I am able to send and receieve tile, toast notifications in my phone. However, my problem is, I want to save all these notifications to a local database in windows phone7.
When the application is running and if a toast message arrives, I can capture that event and we can save the data to local db, its fine.
But if the application is not running, and if I get a toast message, I need to save this message to the local database. I am unable to find a way for this problem. Please help me.
The bad news is that you can't do this at the moment (not in 7.0 or 7.5 Mango)
You can run background tasks on a WP7 device running Mango (7.5) while your app isn't running as detailed here: Windows Phone 7.5 Periodic Tasks
But there are limitations: The task will only fire once every 15 minutes or so, it won't be able to monitor for toasts while the app is off.
If you control the server that is sending the Toast messages then the best bet is for your periodic task to connect to the server every 15 mins and, if there are new toast messages, for it to collect them and then store them in the local DB.