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

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).

Related

WP8.1 silverlight - Notification activated event not being called

I am working on a Windows Phone 8.1 silverlight app, raw notifications handling.
The App when receives notifications in foreground, has to cancel the notification and create a new notification using ToastNotificationManager.CreateToastNotifier().
It also has a backgroundtask to work on the raw notifications received in background, which converts the raw notifications received to toast notification using ToastNotificationManager.CreateToastNotifier().
Also some action A needs to be performed on clicking of this notification.
The issue arises when the App receives the notification when in foreground, but the notification is clicked after suspending the application. Since the registered activated event of such type of notification is not in the background task (because the notification was formed in the foreground logic), no action A is performed on clicking of the notification.
This seems to a limitation, for WP8.1 silverlight apps. Can somebody suggest a solution for this issue??
If you need to do some action after tap on Toast you should add wp:Param to your Toast with deep url and handle in you app.
Toast will be look like
<wp:Notification xmlns:wp=\"WPNotification\">
<wp:Toast>
<wp:Text1>You title</wp:Text1>
<wp:Text2>Your subtitle</wp:Text2>" +
<!-- You can add any parameter you want in deep url -->
<wp:Param>/Page2.xaml?NavigatedFrom=Toast Notification</wp:Param>
</wp:Toast>
</wp:Notification>
When you tap on toast it by default will open Page2.xaml of your app and pass uri parameters to it

Fast App resume not working under password lock screen on windows phone 8

I have implemented Fast resume in my windows phone 8 app and its working fine in every case except following scenario.
Steps:
1)Phone is password locked
2)Toast is received.
3)Tap on toast.
4)App is activated.
5)The page which was last on backstack opens up with reset state.
6)No more navigation
In Fast Resume app should receive one more navigation with deep link on tapping on toast which is missing in this case.
Please find sample here.
This feature of Windows Phone. If the reminder or toast to send from your lock screen (even without a password), the navigation application is limited. I think that there is no way now to fix this behavior ...
I got even more unpleasant situation with reminders of the applications:
1) If screen is not locked and you gave a reminder of the application, then click on the reminder will open the application, you can immediately take action in response to the reminder. All well and good.
2) when the lock screen (even without a password) and you send a reminder of your application, there is no ability to navigate the application by clicking the reminder. Reminder, you can only cancel or postpone for a while. Then the user must unlock the screen, open the program and try to understand what to do in response to this reminder.
At least toast is displayed in the notification center, and the reminder disappears without a trace and the user attempts to find what caused the reminder.
I do not understand why such inconvenient behavior for user application communicates with the lock screen.
Wrote a post on UserVoise, but without response.
Enable to open a task or an appointment directly by tap on the reminder

Windows Phone 8, need to cancel Async task on back key press

I am new to WP8 Aync tasks and have a query-
In WP8, on backbutton press, since it basically pops the last screen from the stack, then why are the Async tasks not cancelled when back key is pressed?
Also, if I am using the HttpWebRequest response, is using Abort() the only way of cancelling the async tasks?
The reason is because Back is a UI concept but things like networking are typically decoupled from the UI. As an example, imagine the user hit "Save" in an app and that started a web request to send their data to the cloud. Then they hit the Back button to go back to the previous page; it would be unexpected for the web request to be aborted and the data to potentially not be saved.
If you have a need to stop tasks when your UI changes (eg, because of resource consumption concerns) then you can try to do that, but I have a vague recollection that Abort is a no-op for Windows Phone 8 (but I could be wrong).

Toast notification disappears after 10 sec in windows phone 8

Toast notification disappears after 10 sec,if user does not tap on that and I am not able to get How to handle this, if user misses the notification.
Requirement is that toast should not disappear untill user taps on it.
One way of doing this is to send toast and tile notification at the same time.so that if user misses the toast notification then he may find it on tile.But not able to get how to do it using push sharp.So please suggest any solution for the following :
How to decide duration of toast notification using push sharp?
If 1st one is not possible then how to send toast and tile notification together using push sharp?
Thanks
A toast notification displays for about 10 seconds unless the user dismisses it with a flick to the right. If the user taps the toast, by default, your app's start screen launches. Or, you can choose to specify which screen of your app will launch.
There is no way to override the duration of the toast notification.

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.