Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6936477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:14:19+00:00 2026-05-27T12:14:19+00:00

I have a background agent that i would like to be executed in Mango

  • 0

I have a background agent that i would like to be executed in Mango for updating the live tile.
The problem is that it is never executed.
Here is the code that i used:

//start background agent 
PeriodicTask periodicTask = new PeriodicTask("BruceWpAgent");

periodicTask.Description = "BruceWp periodic live task";
periodicTask.ExpirationTime = System.DateTime.Now.AddDays(10);

// If the agent is already registered with the system,
if (ScheduledActionService.Find(periodicTask.Name) != null)
{
     ScheduledActionService.Remove("BruceWpAgent");
}

ScheduledActionService.Add(periodicTask);

I’ve found my app name between that Apps that use background jobs but the task is never invoked.
What am i doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:14:20+00:00Added an answer on May 27, 2026 at 12:14 pm

    This code may help you..

    string periodicTaskName = "PeriodicAgent";      
        public bool agentsAreEnabled = true;
        private void StartBackgroundAgent()
        {
            // Variable for tracking enabled status of background agents for this app.
            agentsAreEnabled = true;
            // Obtain a reference to the period task, if one exists
            periodicTask = ScheduledActionService.Find(periodicTaskName) as PeriodicTask;
    
            // If the task already exists and background agents are enabled for the
            // application, you must remove the task and then add it again to update 
            // the schedule
            if (periodicTask != null)
            {
                RemoveAgent(periodicTaskName);
            }
    
            periodicTask = new PeriodicTask(periodicTaskName);
    
            // The description is required for periodic agents. This is the string that the user
            // will see in the background services Settings page on the device.
            periodicTask.Description = "Task to update the Economic times tile.";
    
            // Place the call to Add in a try block in case the user has disabled agents
            try
            {
                ScheduledActionService.Add(periodicTask);
                // If debugging is enabled, use LaunchForTest to launch the agent in one minute.
    
                ScheduledActionService.LaunchForTest(periodicTaskName, TimeSpan.FromMinutes(2));
    
            }
            catch (InvalidOperationException exception)
            {
                if (exception.Message.Contains("BNS Error: The action is disabled"))
                {
                    MessageBox.Show("Background agents for this application have been disabled by the user.");
                    agentsAreEnabled = false;
                }
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem. i'm using the background agend to update my live tile.
Updating live tiles from Background audio agent? I know that you can update Liva
I have a background agent and a foreground app on Windows Phone Mango. (These
I have a background thread that handles communication with an external service. Each time
I have a background thread running that fires events, but how can I ensure
I have a background thread and the thread calls some methods that update the
I have this background, the css code is: body { background: #FFF url('images/bg.png') no-repeat
Some background first. I have a .net client agent installed on each of the
I have failed submission (can't even get past upload verification) because my background agent
I'm using Mango, so I have background tasks. How can I make the thread

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.