|
|
Hi, This example work fine for me.But i see in the code , we need to regist backgroud task by clicking on button register.So it mean we need to launch the app and click on button to regist. is there a way when we install app then it automatic to regist backgroud task ? Thanks in advance.
Hi Le Huu. There currently no way to register background tasks at application install time.
In the C# code snippet in the background tasks doc, it is missing the "myTaskBuilder.SetTrigger(myT rigger);" line. The snippet has the the TimeTrigger in it. This is a follow up to my other post "does not fire the TimeTrigger" which Bob Bao is looking into. Also, if there is a better way to test a TimeTrigger, other than wait 15 minutes, that would be very useful. For example, it could fire once within a minute and 15 minutes afterward. This would help debugging a lot.
Hi RobHogue, You can start a registered background task earlier than 15 minutes on Visual Studio. Start your app, let it register the task, and open a menu where probably its current item is "Suspend", next to the Process information. Click the downarrow and you should see your task name on the menu. Just click on it to run!
Hi,
I am using background task in C# development environment when i start my app the Run method inside the class is not fired, in the manifest i define the settings like :
<Extensions>
<Extension Category="windo ws.backgroundTa sks" EntryPoint="Bac kgroundTaskWork er.LocationBack groundTask">
<BackgroundTask s>
<Task Type="timer" />
</BackgroundTas ks>
</Extension>
</Extensions>
My Run method is inside my LocationBackgro undTask class , and the control is not coming in this class to hit the Run method.
Hi as it is defined in the sample i proceed with that way so my problem is very first time when we are registering the background task its registering and hitting the Run method also but not consistently, i run the sample for Geo Location Tracking inside that when the app is suspended in background we are tracking the location so in sample also the Run method is not fired consistently so i am unable to track the location If u have any idea please share ?
Did everything exactly as in the whitepaper, ran the c# code, registered the task in the sample, set the task on the lock screen as a background task, changed the UTC time zone and waited both at the lock screen and logged in. Nothing happened. What is meant to happen, am I meant to get a notification, popup, update on the notification sample screen? Has anyone got this to work and if so how did you know?
I'm trying to 'see' the results of my test javascript background test working, but so far drawing a blank. A look at the background tasks diagnostics is showing this : A background task with entry point js\fbBackgroundTask.js and name FacebookBackgro undTask has been unregistered because the entry point no longer exists in the task's application package. Any ideas? I have my js\fbBackground Task.js in the application manifest pointing to the entry point, and set as the 'start page' for a timer event (I want to run this every x mins - is it true the minimum you can set is 15 mins?!). Any ideas what this message means?
if you're going to have VB samples, at least test them for some functionality. I read the whole whitepaper on background tasks trying to figure out what was wrong, and then noticed that UpdateBackgroundTaskUI is using IS to compare two strings. It does seem to work if we use = instead.
Hi Dave, Which version of the sample are you looking at? I downloaded the one located above and I no longer see a "UpdateBackgroundTaskUI" method in the implementation.
I have downloaded this sample application for C++. I launched the sample application from Visual Studio-11 on Win8. In the application UI, I select "1) Sample background task" and then click "Register". This mentions "Registers a background task for the Time Zone Change system event. The background task runs whenever the Time Zone changes." After this I go to the Desktop and then select "Change date and time settings..." and then change the Time Zone and press "OK". How do I know that the background task is launched? I do not see any application getting launched after I press "OK" for Time Zone change. If I go back to the sample application, I do not see any update on the UI as well. Is the background task logging any information somewhere? How do I know that?
Hi Himanshu, A couple things that you should be able to use to troubleshoot your problem. 1. Ensure that when you change your timezone you change to one that has a different UTC offset. The task will only fire if the system clock changes due to the time zone change. 2. You can set breakpoints in the Tasks::SampleBackgroundTask.Ru n method to verify that they are running, you should also see UI updates in the output portion of the sample from progress and completion callbacks.
Can C++ be used for creating a background task? Should a background task object be implemented as a WinRT component? Is there anything that is different for C++ implementations that should be noted? Thanks
The answer to my own question is yes to build a background task object in C++ you create a WinRT component and implement the IBackgroundTask::Run method.
I have written a short article on how to do it in C++ http://progmar.wordpress.com/2 012/01/30/backg round-task-samp le-in-c/
Yes, C#, JavaScript, C++, and Visual Basic are all supported languages for background tasks. This sample is currently being updated for beta and samples for all four languages will be available.
I just replace the SystemTrigger with TimeTrigger, but the task was not fired: I have add the Timer in the manifest.
BackgroundTaskB uilder myTaskBuilder = new BackgroundTaskB uilder();
//
// Create a new InternetAvailab le trigger.
//
//var myTrigger = new SystemTrigger(S ystemTriggerTyp e.InternetAvail able, false);
TimeTrigger myTrigger = new
TimeTrigger(15, false);
//
// Associate the InternetAvailab le trigger with the background task builder.
//
myTaskBuilder.S etTrigger(myTri gger);
System.Diagnost ics.Debug.Write Line(DateTime.N ow + "Stat ...");
//
// Specify the background task to run when the trigger fires.
//
myTaskBuilder.T askEntryPoint = SampleBackgroun dTaskEntryPoint ;
//
// Name the background task.
//
myTaskBuilder.N ame = SampleBackgroun dTaskName;
//
// Register the background task.
//
var myTask = myTaskBuilder.R egister();
//
// Associate progress and completed event handlers with the new background task.
//
myTask.Progress += new BackgroundTaskP rogressEventHan dler(OnProgress );
myTask.Complete d += new BackgroundTaskC ompletedEventHa ndler(OnComplet ed);
System.Diagnost ics.Debug.Write Line(myTask.Nam e + " "+ myTask.TaskId);
UpdateSampleBac kgroundTaskUISt ate(true);
In order for timer tasks to fire the application must currently be on the lock-screen. This sample is currently in the process of being updated for BETA and the updated sample has more information.
Yes, C#, JavaScript, C++, and Visual Basic are all supported languages for background tasks. This sample is currently being updated for beta and samples for all four languages will be available.
I want to make an App which is like a mail App. So, I want to know how to provide my icon to show on the lockScreen, and how can I update the number which show user there is how many mail is new for him ?