Download presentation
Presentation is loading. Please wait.
Published byMorgan McCoy Modified over 9 years ago
12
XML badge update schema <badge value = "1-99" | "none" | "activity" | "alert" | "available" | "away" |... version? = "integer" />
13
XML tile update schema <visual version? = "integer" lang? = "string" baseUri? = "anyURI" branding? = "string" addImageQuery? = "boolean" > <binding template = "TileSquare150x150Image" | "TileSquare150x150Block" |... fallback? = "TileSquareImage" | "TileSquareBlock" |... contentId = "string" lang? = "string" baseUri? = "anyURI" branding? = "string" addImageQuery? = "boolean" > <image id = "integer" src = "string" alt? = "string" addImageQuery? = "boolean" />
14
XML toast notification schema <visual version? = "integer" lang? = "string" baseUri? = "anyURI" branding? = "string" addImageQuery? = "boolean" > <binding template = "ToastImageAndText01" | "ToastImageAndText02" |...="" fallback? = "string" lang? = "string" baseUri? = "anyURI" branding? = "string" addImageQuery? = "boolean" > <audio src? = "ms-winsoundevent:Notification.Default" |... loop? = "boolean" silent? = "boolean" />
24
Building a Cloud Service with Window Azure
26
Renewing WNS channels (register task, C#) using Windows.ApplicationModel.Background; BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder(); MaintenanceTrigger trigger = new MaintenanceTrigger( 10 * 24 * 60, false); //10 * 24 * 60 == 10 days taskBuilder.SetTrigger(trigger); //In JavaScript, taskEntryPoint is the path of a.js file taskBuilder.TaskEntryPoint = "PushNotificationsHelper.MaintenanceTask"; taskBuilder.Name = "UpdateChannels"; SystemCondition internetCondition = new SystemCondition( SystemConditionType.InternetAvailable); taskBuilder.AddCondition(internetCondition); taskBuilder.Register();
27
Renewing WNS channels (task, C#) using System; using System.Threading.Tasks; using Windows.ApplicationModel.Background; namespace PushNotificationsHelper { public sealed class MaintenanceTask : IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { // This is a helper function to renew WNS channels. // Important here to not block the UI thread. Notifier notifier = new Notifier(); notifier.RenewAllAsync(false).AsTask().Wait(); }
28
Renewing WNS channels (task, JavaScript) // This code runs as a web worker (function () { // Import the Notifier helper object importScripts("//Microsoft.WinJS.1.0/js/base.js"); importScripts("notifications.js"); var closeFunction = function () { close(); // This is worker.close }; var notifier = new SampleNotifications.Notifier(); notifier.renewAllAsync().done(closeFunction, closeFunction); })();
29
Receiving raw notification (register task, C#) using Windows.ApplicationModel.Background; using Windows.Networking.PushNotifications; BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder(); PushNotificationTrigger trigger = new PushNotificationTrigger(); taskBuilder.SetTrigger(trigger); taskBuilder.TaskEntryPoint = "BackgroundTasks.RawNotification"; taskBuilder.Name = "ReceiveRawNotification"; taskBuilder.Register();
30
Receiving raw notification (task, C#) using System.Diagnostics; using Windows.ApplicationModel.Background; using Windows.Networking.PushNotifications; using Windows.Storage; namespace BackgroundTasks { public sealed class RawNotification : IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { // Get the background task details ApplicationDataContainer settings = ApplicationData.Current.LocalSettings; // Store the content received from the notification so it // can be retrieved from the UI. RawNotification notification = (RawNotification)taskInstance.TriggerDetails; settings.Values[taskName] = notification.Content; }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.