Get the title of toast notification in background task - windows-store-apps

I can trigger the background task with ToastNotificationHistoryChangedTrigger once we removed the toast notification from the action center,I want to get the title of closed notifications in the background task of UWP.

It seems it's not possibile without calculating the delta between your notifications collection before and after deletion.
The API you're using was designed with wearables in mind.
The background task is simply a shoulder tap. It does not provide any information about which specific notification was added or removed. When your background task is triggered, you should sync the notifications on your wearable so that they reflect the notifications in the platform. This ensures that if your background task fails, notifications on your wearable can still be recovered the next time your background task executes.
See the documentation for more informations.

Related

How to reload gmail add-on through background process using app-script

May i get some help on the below points where i am using app-script to develop a gmail add-on:
How can we refresh gmail add-on with back ground process?
=> Here is my case, I need to display card with multiple sections which is the process of hitting multiple apis to fetch data and to display the card. For this initially we will show a card with minimal information to the user once i get information from api, i need to update the basic cards with complete information.
How can we trigger a function on every mail thread open?
=> Currently it works once for a mail, here as explained above point need to refresh a card once we fetch the data. If not, user will be seeing same basic information card every time he opens the mail.
From above mentioned issues for point one we are trying to get solution where we can hit service for certain interval of time to check data availability and if data exists then fetch data and update cards, i mean to say need a setTimeout function kind of thing, unfortunately we did'nt found this in app script and We found sleep/waitLock functions in app-script, but my services may take little time to fetch data as it connects though multiple services so we cant make the user to wait until the whole process is to be completed. So that we will show a card with basic information required then after need to auto refresh the cards once we fetch the data. we tried of keeping refresh button for the user to click and fetch the updated data but here we are losing user experience, trying for auto refresh with out user interference to get updated information.
Need a process / solution where we can auto refresh the card with out user interference after the data available at our end instead of making user to wait until the process to be completed.
Earliest reply will be more helpful for us.
Thanks.
If a data status on a third-party backend changes as the result of a user interaction with your add-on UI, it is recommended that the add-on set a 'state changed' bit to true so that any existing client side cache is cleared. See the ActionResponseBuilder.setStateChanged() method description for additional details.
The card-based interface in Gmail Addons is an Apps Script Service.
You can interlink it with other Apps Script services as well as implement API calls - everything within the same Apps Script file.
Gmail Addons contents automatically update every time the user opens a different e-mail or refreshes his browser.
Within your Apps Script code you can install time-driven triggers to run the data availability check with a customized frequency.
Consider to install for your users an Auto Refresh extension if you do not want them to refresh the card themselves.

How to trigger a "flyout, dialog, app bar or other inline element" if the phone receives a notification while the app is closed?

I'm working on a Windows Phone app that will receive push notifications and needs to show critical alerts to the user. As far as I can see there are 3 types of push notification:
Raw Notification - Raw notifications are used when your application is actually running on the device. This allows you to
update your interface “live” as the user is using it.
Toast Notification – This message will be received regardless of whether your application is running or not, but popping toast messages
while your app is running might be a little annoying. I’ll
demonstrate this example below. Toast WILL NOT also update your
application’s data. You still need to pass a Raw Notification to make
this happen.
Tile Notification – If your application is pinned to the user’s Start screen, you can update the Tile for your application. You can
change the background image, as well as an integer from 0-99.
source: http://www.jeffblankenburg.com/2010/10/19/31-days-of-windows-phone-day-19-push-notifications/
These each have different behaviours, but none lend themselves to critical notifications, where the user can be actively alerted to critical information.
Having read Guidelines for toast notifications on MSDN, it suggests
Don't use toast notifications to notify the user of something that
must be seen, such as a critical alert. To ensure that the user has
seen your message, notify them in the context of your app with a
Flyout, dialog, app bar, or other inline element.
So the question is, how can I trigger a "flyout, dialog, app bar or other inline element" if my app is closed and the phone receives a critical notification.
long story short: you can't enforce that your app opens on an incoming pns
But I think you've got the toast scenario wrong. A toast can be used to notify the user, if he taps it the app opens and you might react to that by the navigation uri (e.g.: ?fromToast=true).
If you receive a toast notification while your app is open the toast won't show. Toast Notifications only get displayed when your app isn't open. But you can react to an incoming toast notification (there's an event for that) to implement an behavior of your way (e.g.: flyout, msgbox, ...).
note: introduced with GDR3: The sound of the toast notification can now be changed (even made silent).

How to avoid MessageDialog in Page Navigation

In my application hitting service call on every page navigation and showing MessageDialog to user.
My problem was when I hitting service call (await) on page navigation "Page1" to "Page2" whereas service call taking certain time to complete meantime user taps back to "Page1"
In that case user seeing "Page1" and await service call completed on "Page2" and showing that service response message in "Page1".
How can I avoid MessageDialog suppose user navigates back from that page.
First of all, you should avoid using MessageDialogs for this sort of information. You should think about using a ProgressBar or ring to indicate that your app is performing a task in the background (calling your service). This way, your users won't be interrupted in their interactions with the app, yet still be aware that something is going on in the background.
If you are using an MVVM pattern, your ViewModel or Model classes should be doing the heavy lifting of talking to the service. If your app absolutely must show MessageDialogs, I'd recommend creating an event in your back-end classes that will cause the UI to show the MessageDialogs on completion of the call. That way you can subscribe to those events when you load the page, and unsubscribe from them when you navigate away. In this way you can avoid messages appearing from Page2 when you are on Page1 of your app.

How to discard old toast notifications without closing push channel?

According to MSDN, MPNS will put the notification requests in queue for delivery, so there is always time delay for them to get to device. My problem is that, sometimes, for example when the device goes to Temp Disconnected mode, the time delay is so long that the toast notifications become outdated when they arrive. Is there a way to discard/ignore these old toast notifications without renew the current push channel? If not, is it all right for me to renew push channel every time I open app?
As far as I know, it's OK to renew the channel every time you open the app. If your app is not running and you don't have a background task getting these notifications, you will automatically be discarding them anyway. Also, if my memory serves me correctly, should you use the channel request with an object that has been previously used to receive stuff from the channel, you can get the same channel (I might be wrong here). In this case, if you get old messages, you probably have to handle the local discarding manually.

Handle push notification on background

I am developing an application in windows phone which having push notification facility. I am able to receive push message at device.
If Application is not running , I am getting message at home screen on the click of that msg it starts that application. I want to perform some task on the basis of that Push Notification Message. But i am not able to handle that event.
Please help me to handle that EVENT if application is running or application is in background or application is not running .
Thanking You,
Which type of notification are you sending? Based on your question I assume you are referring to toast notifications.
When do you want to perform the task - before or after the user clicks on the message? If the application is not running, you can only do it after clicking the message.