locked
register for background task in metro apps RRS feed

  • Question

  • Hi All,

    I registered for a background and its working fine if the task is created in a separate project of type "Windows runtime component".

    Can we use create and register for the background task within the Windows 8 application instead of creating another project?

    When I try to debug the task created within one solution(Windows 8 application), application stops running. Can someone explain the need of "Windows runtime component" project for registering background task?


    Nazia

    Wednesday, February 20, 2013 12:27 PM

Answers

  • Hey Nazia,

    First of all, if you look at the outputs of the two project types (i.e. Windows Store App, Windows Runtime Component); windows store app prepares an appx package that contains the xaml files, assemblies and windows runtime components if any. However the Windows Runtime Component project prepares a WINMD file. The name stands for Windows Meta Data. Windows runtime components are also used to prepare shared components between different apps. there is a nice article on msdn blogs.

    It is this metadata file that is used by the background task execution framework. Essentially the execution happens on that specific component.

    As you can image, the background task execution and application runtime are almost completely separate.

    If we were to make an analogy (for sharepoint developers exclusively :) ), while the store app project can be a complete sharepoint solution (wsp) and the execution is done by the application pool, the SP Job (i.e. Background Task) is just a feature that is executed by a completely separate service.

    Hope I didn't convolute your understanding more. :)


    Can Bilgin
    Blog Samples CompuSight

    • Proposed as answer by Aaron Xue Friday, February 22, 2013 8:10 AM
    • Marked as answer by Nazia Firdouse Friday, March 1, 2013 5:04 AM
    Wednesday, February 20, 2013 2:15 PM