#win8aca : how and when metro style apps run

Click here to load reader

Post on 28-Nov-2014

1.296 views

Category:

Technology

0 download

Embed Size (px)

DESCRIPTION

 

TRANSCRIPT

  • 1. Apps do not get notified when they are getting terminated
  • 2. demo
  • 3. UserLaunches App Splash screen
  • 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. demo
  • 6. Scenario You should.
  • 7. demo
  • 8. demo
  • 9. Tile launch activation activatedUser taps on Tile Running app launch event eventArgs.kind Splash Screen shown
  • 10. HTTP POSTNotification Delivered
  • 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. 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.
  • 14. demo
  • 15. CPU resource quota Refresh period Lock screen appNon-lock screen app