In-Process Background task - windows-store-apps

I am new to background task, According to msdn article the In-Process background task will executed in application process.Is In-process background task will trigger if the application is not running?

Is In-process background task will trigger if the application is not running?
Yes.
In-process background tasks are simpler to implement than out-of-process background tasks. However, they are less resilient. If the code running in an in-process background task crashes, it will take down your app.
Also note that DeviceUseTrigger, DeviceServicingTrigger and IoTStartupTask cannot be used with the in-process model. Activating a VoIP background task within your application is also not possible. These triggers and tasks are still supported using the out-of-process background task model.
Please check MSDN document for more details:Create and register an in-process background task

Related

Using AS3 Timer & distriqt Notification ANE To Send Notifications While In Sleep Mode

I'm using the AS3 Timer class to sync data between a Flex Mobile app and a server ideally every 30 mins then send a local (distriqt) Notification to the user when action is required.
However, when the device goes into sleep / hibernate mode it seems to slow down, even stop the Timer. I've tried using a lower interval (5mins) but it still only works intermittently.
This is very hard to test as the behavior is different in debug / run modes.
Any suggestions?
Thanks.
Sounds like you might need to change your approach here. Background operation of applications is very different from the foreground.
Your application will run for a little while (depending on the current device memory load among other things) and will then enter a suspended mode, mainly to preserve the application's memory state.
There are some background mode exceptions to this, such as audio playback and location updates, however if you aren't performing these then Apple will most likely reject your application as part of the review process.
You can also investigate the executeInBackground flag on the NativeApplication. This allows a long running task to execute in the background, however this does not guarantee that the application would run in the background continuously.
You can read more here: http://blogs.adobe.com/airodynamics/2012/05/04/air-ios-background-behavior/
UIBackgroundModes: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW22

Long-running task performed in foreground is suspended when app goes to background

When a user first opens my app, I need to download and install some content from a server before they can begin using the app. The problem is that this takes around 5 minutes on wifi, during which time the app goes into the background and the download is suspended.
Is there any way to either:
Prevent an windows app from entering the background while I perform my download
or continue peforming the task in the background (i.e. perform the task irrespective of whether the app is in the foreground or background)
Also, I don't want to use the BackgroundDownloadManager
Thanks
When the app is being suspended, all processes are stopped and and background task cancelled. Your last chance to do something is Suspending event - see more at MSDN.
In your case, when you need to download big file in the background - the mentioned BackgroundDownloader would be the best option - it's designed for such tasks. In other cases you will have to convince user to leave the app in the foreground (a message?), also take care about lockscreen (see DisplayRequest class).
I'm not also sure but maybe you will be able to use BackgroundTask (separate process), triggered with MaintanceTrigger - but then user will be able to download the file only in specific circumstances and probably not right away.

Windows 8.1 background task terminated when application is launched

I'm encountering a strange issue when a background task is executing then the user launches the foreground application. If the user launches the app while the background task is executing, the background task is terminated. Is this normal or expected behavior?
The background task begins and ends with success in the following scenarios:
The foreground app is currently running
The foreground app is not running
I've read the following post as it seems to be the exact issue I'm experiencing. However, the responses don't apply since I already have a reference to the background task project. This is required for a background task to even work and be registered.
Update 3/16/2014
I've discovered that this may be more edge case than I originally anticipated. In the following scenario the application is launched successfully and the background task is not terminated.
Fresh boot of machine
Background task is manually triggered (currently triggered by InternetAvailable)
Launch Application
What I've discovered is that when the following steps are run the background task will terminate upon application launch
Launch application
Manually close application
Trigger background task
Launch application (application is displayed immediately as if it was suspended. Oddly enough when I run the application after closing it every other time the splash screen is always displayed. In this scenario when the background task is triggered the application seems to be in a suspended state)
Manually close application
Launch application
Again, I understand this is a very odd set of steps to reproduce this issue but if anybody is running across this or it is an expected behavior please let me know.
Thanks in advance.

Winrt BackgroundTask Executes

When adding a background task in WinRT with a trigger of SystemTriggerType.InternetAvailable
if the internet is available when the task is registered will if execute right then? or will the task wait for the internet to not be available and then available again to execute?
Or can I force execution of that background task when my app is active?
A backround task with SystemTriggerType.InternetAvailable will only start when Internet becomes available. If it's already available when the task is registered, it won't trigger.
If you need to execute that code even if internet is available all the time, the best thing would be to create another background task with TimeTrigger and SystemConditionType.InternetAvailable. You are allowed to set it to the minimum interval of 15 minutes.
If you also need to be able to execute the same code from your app immediately, then put the relevant code in a separate library and call it both from the background tasks and the application code.

Flex - Run Air Application In Background

I am trying to provide my users with the option to have my application launch automatically and complete a task at a certain time every week.
I can make my application launch at log in using NativeApplication.nativeApplication.startAtLogin=true but I then want to detect if the time is the time they selected and if it isn't then run the application in the background until the time does match or the user shuts down their computer.
Does anyone know of a way to do this? On Adobe's webpage comparing Flex web apps and desktop apps it implied to me that applications could be run in the background but I'm struggling to find anything.
You can close the initial native window without killing the process
NativeApplication.nativeApplication.autoExit = false;
NativeWindow(this.stage.nativeWindow).close();
OR
You can close the initial native window and create a new window that acts as a desktop widget without appearing in the taskbar with either the UTILITY or LIGHTWEIGHT window type.
http://help.adobe.com/en_US/air/reference/html/flash/display/NativeWindowInitOptions.html#type
Either you keep the process running which times when the next 'job' should be ran, or you can set a system cron job (or something similar) which is specific to the OS. You'll want to use the NativeWindow option of 'LIGHTWEIGHT' so that your application doesn't show up to the user.
Personally, for these kinds of processes, I don't even try to use Air since it isn't really made for this kind of stuff. It's meant to be used for UI based apps and not process based. Use Java or C# instead.