#win8aca : How and when metro style apps run

1,287 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,287
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
43
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

#win8aca : How and when metro style apps run

  1. 1. Apps do not get notified when they are getting terminated
  2. 2. demo
  3. 3. UserLaunches App Splash screen
  4. 4. //Register for the Suspending event and call suspendingHandler when receivedWindows.UI.WebUI.WebUIApplication.addEventListener("suspending", suspendingHandler);//Handle the suspending event and save the current user session using WinJS sessionStatefunction suspendingHandler(eventArgs) {//We are getting suspended}//Register for the Resuming event and call resumingHandler when receivedWindows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler);function resumingHandler() {//We are getting resumed, in general do nothing}
  5. 5. demo
  6. 6. Scenario You should….
  7. 7. demo
  8. 8. demo
  9. 9. Tile launch activation activatedUser taps on Tile Running app launch event eventArgs.kind Splash Screen shown
  10. 10. HTTP POSTNotification Delivered
  11. 11. Trigger ConditionTimeTrigger* InternetAvailable,PushNotificationTrigger* InternetNotAvailable,SessionStart* SessionConnected,ControlChannelTrigger*(**) SessionDisconnected,ServicingComplete UserNotPresent,SessionConnected UserPresentSessionDisconnectedSmsReceivedTimeZoneChangeUserAway/UserPresent,LockScreenApplicationAdded/RemovedOnlineIdConnectedStateChangeInternetAvailableInternetAvailable/InternetNotAvailableNetworkNotificationChannelResetNetworkStateChangeMaintenanceTrigger *requires lock permissionPushNotificationTrigger** **can run in App (not BackgroundHost.exe)
  12. 12. function RegisterSampleBackgroundTaskWithCondition(){ var builder = new Windows.ApplicationModel.Background.BackgroundTaskBuilder(); builder.name = "BackgroundTestWorker"; builder.taskEntryPoint = "BackgroundTestWorker.js";// run a timetrigger for every 15 minutes var myTrigger = new Windows.ApplicationModel.Background.TimeTrigger(15, true); builder.setTrigger(myTrigger);// required condition: internetAvailable var condition = newWindows.ApplicationModel.Background.SystemCondition(Windows.ApplicationModel.Background.SystemConditionType.internetAvailable); builder.addCondition(condition);// register the task var task = myTaskBuilder.register(); task.addEventListener("progress", task_Progress); task.addEventListener("completed", task_Completed);}
  13. 13. <Application Id="App" StartPage="default.html"> <VisualElements DisplayName="SimpleBackgroundTask" Logo="imageslogo.png" SmallLogo="imagessmalllogo.png" Description="SimpleBackgroundTask" ForegroundText="light" BackgroundColor="#000000"> <LockScreen Notification="badge" BadgeLogo="badgelogo.png" /> <SplashScreen Image="imagessplashscreen.png" /> </VisualElements> <Extensions> <Extension Category="windows.backgroundTasks" StartPage="backgroundTaskLogger.js"> <BackgroundTasks> <Task Type="timer" /> <Task Type="systemEvent" /> </BackgroundTasks> </Extension> </Extensions> </Application>
  14. 14. demo
  15. 15. CPU resource quota Refresh period Lock screen appNon-lock screen app

×