locked
create a background task for network status change

    Question

  • I want to have a background task which gets called which gets triggered when I change from one network to another .Suppose i am connected to a mobile broadband and then switch to wifi , then it should get triggered .When it switches from wifi to mobile broadband , it should trigger 

    I have wirtten code as :

                var builder = new BackgroundTaskBuilder();
                builder.Name = name;
                builder.TaskEntryPoint = taskEntryPoint;
                builder.SetTrigger(new SystemTrigger(SystemTriggerType.NetworkStateChange, false));

                if (condition != null)
                {
                    builder.AddCondition( new SystemCondition(SystemConditionType.InternetNotAvailable));
                }

                BackgroundTaskRegistration task = builder.Register();

    But it works fine when i switch within interface but not  from one interface to another

    Wednesday, May 21, 2014 9:49 AM

All replies

  • what if you remove the condition?

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    • Proposed as answer by Dave SmitsMVP Wednesday, May 21, 2014 12:21 PM
    • Unproposed as answer by Dave SmitsMVP Wednesday, May 21, 2014 12:21 PM
    Wednesday, May 21, 2014 12:21 PM