Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine when a Windows 8 app is launched by Notification

I have notifications going to my application, I want to be able to take the user to that page in my application when they click on the notification or live tile (current displayed item).

Is there a way to determine what the tile data is when your app is launched from a Live Tile or Toast Notification?

Also, users have the ability to right click on a live tile and turn it off. Is there a way to detect that so I can turn off sending them live tiles or does WNS handle that?

Thanks!

like image 770
Dave Avatar asked Oct 27 '12 18:10

Dave


People also ask

How do I check notifications on Windows 8?

Notifications at a glanceSelect the date and time in the taskbar to open the Notification Center. (You can also swipe in from the right edge of your screen, or press Windows logo key + N.) Select the notification to read more or take action.

What are app notifications?

A notification is a message that Android displays outside your app's UI to provide the user with reminders, communication from other people, or other timely information from your app. Users can tap the notification to open your app or take an action directly from the notification.


2 Answers

Windows does not provide a way to determine the tile content when a user launches the app via a tile. Per the UX guidelines launching from each of the following should have the corresponding behavior:

  • Main tile: The app should launch to the last place the user left the app or the app home page.
  • Secondary tile: The app should launch to specific content in the app.
  • Toast: Like a secondary tile, the app should launch to specific content in the app.

All three of types of activation will cause the OnActivated event to be fired with the IActivatedEventArgs.Kind parameter set to ActivationKind.Launch.

For both secondary tile and toast activations, the app can provide an additional context in the LaunchActivatedEventArgs.Argument parameter.

For secondary tiles, the launch arguments parameter can be set upon creation of the tile via the SecondaryTile.Arguments property.

For toast notifications, the launch arguments parameter is set as an attribute in the toast notification XML:

<toast launch="myLaunchContext">
    ...
</toast>

Lastly, apps should not need to check whether the tile has been turned on or off by the user. Windows and WNS will determine whether delivery is required. The user can turn the tile on/off while an app is not running, so the state saved by the app may be out of sync with the setting.

like image 79
Nathan Kuchta Avatar answered Sep 28 '22 02:09

Nathan Kuchta


you can detect the app lunch in App.xaml.cs

    protected override void OnActivated(IActivatedEventArgs args)
    {
        base.OnActivated(args);

        if(args.Kind == ActivationKind.Launch)
        {

        }
    }

Here is info on how to handle ToastNotification click event.

like image 43
Mayank Avatar answered Sep 28 '22 01:09

Mayank