locked
Cannot register to background task in Javascipt Windows app

    Question

  • I am using Javascript to register a background task. Everything goes ok, but I cannot register.

    var background = Windows.ApplicationModel.Background;                     
    var builder = new background.BackgroundTaskBuilder();
    
      
    
    builder.Name = "Background Task for Loadshedding App";
                    
    builder.TaskEntryPoint = "../js/backgroundTask.js";
    builder.setTrigger(hourlyTrigger);                   
    
                    
    var task = builder.register(); //Error points to this line

    Error: 0x80040154 - JavaScript runtime error: Class not registered




    Sunday, October 26, 2014 9:30 PM

Answers

  • Sounds like you did not have correctly setting in app manifest background task properties, could you try to validate them again? For instance if the name are the same.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 27, 2014 2:25 AM
    Moderator
  • Hi,

    Spotting some issues from your code:

    - The property names of builder should be lowercased: builder.name and builder.taskEntryPoint

    - The reference to the JavaScript file might need tuning, please see http://msdn.microsoft.com/en-US/library/windows/apps/windows.applicationmodel.background.backgroundtaskbuilder.taskentrypoint.aspx. Make sure the path is correct in both manifest and the taskEntryPoint assignment. After brief testing, I'm seeing also the "Class not registered" error if the path for taskEntryPoint is not correct.


    Tuesday, November 4, 2014 5:21 PM

All replies

  • Sounds like you did not have correctly setting in app manifest background task properties, could you try to validate them again? For instance if the name are the same.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 27, 2014 2:25 AM
    Moderator
  • Hi,

    Spotting some issues from your code:

    - The property names of builder should be lowercased: builder.name and builder.taskEntryPoint

    - The reference to the JavaScript file might need tuning, please see http://msdn.microsoft.com/en-US/library/windows/apps/windows.applicationmodel.background.backgroundtaskbuilder.taskentrypoint.aspx. Make sure the path is correct in both manifest and the taskEntryPoint assignment. After brief testing, I'm seeing also the "Class not registered" error if the path for taskEntryPoint is not correct.


    Tuesday, November 4, 2014 5:21 PM