Presentation is loading. Please wait.

Presentation is loading. Please wait.

12/2/2018 12:23 PM APP-410T Real time communication: keep your Metro style app connected whether it is running or suspended Raghu Gatta Principal Development.

Similar presentations


Presentation on theme: "12/2/2018 12:23 PM APP-410T Real time communication: keep your Metro style app connected whether it is running or suspended Raghu Gatta Principal Development."— Presentation transcript:

1 12/2/ :23 PM APP-410T Real time communication: keep your Metro style app connected whether it is running or suspended Raghu Gatta Principal Development Lead Microsoft Corporation Kamal Srinivasan Program Manager Microsoft Corporation © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 Agenda Real Time Communication (RTC) app requirements
User in control of the RTC apps Building your RTC app in Windows 8 You’ll leave knowing how to Build communication apps that work 24x7

3 Customer promise in Windows 8
Longer battery life Always reachable apps

4 Review app process lifetime
Running App Suspended App Terminated App Suspending Low Memory Resuming

5 RTC apps that need to be always reachable
What about RTC apps? VoIP IM Mail RTC apps that need to be always reachable

6 Windows enables you to develop apps that are always reachable!

7 The app lifecycle …with RTC apps Background Task Executes Background
Running App Suspended App Terminated App Suspending Low Memory Resuming

8

9 Running an app in the background
12/2/ :23 PM demo Chat app (PingMe) Running an app in the background © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

10 RTC trigger APIs for your apps
OS VoIP IM Mail Network Trigger System Trigger Time Trigger Background Task Infrastructure

11 Building an always reachable IM app

12 Building an IM app on Windows 8
Network Trigger System Trigger Time Trigger Background Task Infrastructure VoIP IM Mail Network Trigger System Trigger Receive an IM when app is in the background Receive an IM after user logs in

13 Execution Pattern App registers for trigger OS waits Trigger fires
Background task executes

14 Register for IM network trigger
Open your socket using Windows.Networking.Sockets; StreamSocket sock = new StreamSocket(); // Connect the streamsocket // Create a Notification Channel with Push capability NotificationChannel nc = new NotificationChannel( "channelOne", “MyApp.Background.KeepAliveTask", “MyApp.Background.PushNotifyTask", ServerKATimeInMins); Add Control Channel metadata // Associate the socket with the notification channel channelStatus = nc.UsingTransport(sock); Register your socket © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

15 App execution upon receiving IM
Network Trigger App execution upon receiving IM using Windows.ApplicationModel.Background; public sealed class PushNotifyTask : IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { // Handle Incoming message // Throwing a toast code } © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

16 Keep Alive maintains your control channel
Network Keep alive Interval Server Keep alive Interval

17 App execution on Keep Alive
Network Trigger App execution on Keep Alive using Windows.ApplicationModel.Background; public sealed class KeepAliveTask : IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { // Send Keepalive message to remote server } }} © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

18 Register on User Login using Windows.ApplicationModel.Background;
System Trigger Register on User Login Create user login trigger using Windows.ApplicationModel.Background; // Specify the trigger IBackgroundTrigger trigger = new SystemTrigger(SystemTriggerType.SessionStart, false); Associate trigger with app code // Associate app code with the trigger BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder(); taskBuilder.TaskEntryPoint = “MyApp.Background.RegisterForUserLogin"; taskBuilder.SetTrigger(trigger); taskBuilder.Name = “OnUserPresent"; Register trigger // Register the task for background execution IBackgroundTaskRegistration taskRegistration = taskBuilder.Register(); © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

19 App execution on User Login
System Trigger App execution on User Login using Windows.ApplicationModel.Background; public sealed class RegisterForUserLogin: IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { // Your app code to create notification channel } © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

20 Receive an IM when in “Connected Standby”
12/2/ :23 PM demo Chat app (PingMe) Receive an IM when in “Connected Standby” © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

21 Always connected Mobile broadband (e.g. 3G, 4G, LTE, etc.)
Network Connectivity

22 How does this work in connected standby?

23 Nothing special, one model to stay connected.

24 Building a POP mail client with periodic updates

25 Building a POP mail app on Windows 8
Network Trigger System Trigger Time Trigger Background Task Infrastructure VoIP IM Mail Time Trigger Periodic Mail Sync

26 Register for Periodic Mail Sync
Time Trigger Register for Periodic Mail Sync Create time trigger using Windows.ApplicationModel.Background; // Specify the trigger TimeTrigger trigger = new TimeTrigger(UpdateInterval, Periodic); Associate trigger with app code // Associate app code with the trigger BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder(); taskBuilder.TaskEntryPoint = “MyApp.Background.Update Task"; taskBuilder.SetTrigger(trigger); taskBuilder.Name = “TimerExpiry"; Register trigger // Register the task for background execution IBackgroundTaskRegistration taskRegistration = taskBuilder.Register(); © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

27 App execution upon timer expiry
Time Trigger App execution upon timer expiry using Windows.ApplicationModel.Background; public sealed class Update Task : IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { // Your app code to update } © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

28 Review

29 Key points Longer Battery Life Always Reachable Apps

30 Write your RTC app code using background tasks.
Key points Write your RTC app code using background tasks. Your app will be always reachable in connected standby.

31 Related sessions [APP-409T] Fundamentals of Metro style apps: how and when your app will run [HW-456T] Understanding Connected Standby [HW-566T] Networking for connected standby [PLAT-785T] Creating connected apps that work on today's networks [APP-396T] Using tiles and notifications

32 Further reading and documentation
Introduction to Background Tasks Contact info – (optional)

33 thank you Feedback and questions http://forums.dev.windows.com
Session feedback

34 12/2/ :23 PM © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

35 Backup

36 Lock Screen API sample void AddToLockScreen() {
    IAsyncOperation<LockScreenState> operation = LockScreen.AddToLockScreenAsync();     operation.Completed = OnAddToLockScreenOperationCompleted;     operation.Start(); } void OnAddToLockScreenOperationCompleted(IAsyncOperation<LockScreenState> operation) {     if (operation.Status == AsyncStatus.Completed)     {         LockScreenState result = operation.GetResults();         switch (result)         {             case LockScreenState.NotOnLockScreen:                 break;             case LockScreenState.OnLockScreen:             case LockScreenState.DefaultNotOnLockScreen:         }     }     else if (operation.Status == AsyncStatus.Error){ // Report error © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

37 Registering for Network Change
System Event Registering for Network Change using Windows.ApplicationModel.Background; // Specify the trigger IBackgroundTrigger trigger = new SystemTrigger(SystemTriggerType.NetworkStateChange, false); // Associate app code with the trigger BackgroundTaskBuilder taskBuilder = new BackgroundTaskBuilder(); taskBuilder.TaskEntryPoint = “MyAppBackground.NetworkStateChangeTask"; taskBuilder.SetTrigger(trigger); taskBuilder.Name = “OnNetworkStateChange"; // Register the task for background execution IBackgroundTaskRegistration taskRegistration = taskBuilder.Register(); © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

38 App execution upon network change
System Event App execution upon network change using Windows.ApplicationModel.Background; public sealed class NetworkStateChangeTask : IBackgroundTask { public void Run(IBackgroundTaskInstance taskInstance) { // Re-register Notification Channel } © 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

39


Download ppt "12/2/2018 12:23 PM APP-410T Real time communication: keep your Metro style app connected whether it is running or suspended Raghu Gatta Principal Development."

Similar presentations


Ads by Google