I cannot find some coherent information on this so I am asking here.
I need to write an iOS app that needs to perform a webservice call every x minutes to update the slqite db on the device, even if the application is not running in the foreground.
From google what I could find out was that iOS will only allow your app to run a small time after closing(to finish an upload etc).
e.g. "AIR does not provide support for this iOS background processing model": http://www.adobe.com/devnet/air/articles/considerations-air-apps-mobil e.html#articlecontentAdobe_numberedheader_5
Can I do what I need in Air 3.3+ an iOS 5.1+ ?
Did you finally found a solution?
According to that:
we should be able to execute task in background. But not any of my events (ENTER_FRAME, TIMER or SOUND_COMPLETE) are fired. SetTimeout neither.
Flex SDK 4.6 / AIR 3.4 / FlashDevelop / Windows 7
Please let me know if you have found something.
AIR 3.3 onwards, action script developers can execute short task in the background along with audio playback and location updates on iOS. In order to execute task in background, you would need to set
1) NativeApplication.nativeApplication.executeInBackground = true (in action script)
2) swf version should be 16 or more
3) namespace should be 3.3 or more (in application descriptor)
Please confirm if you have used the above settings in your app.
I have NativeApplication.nativeApplication.executeInBackground = true in my Main.as
I also turn this property to true on NativeApplication.nativeApplication Event.DEACTIVATE
I compile with -swf-version=17 in my compiler options.
I use namespace 3.4 in the manifest.
I do my tests under iOS 6 on iPad 2, iPhone 4, iPhone 5, Acer Iconia tab/Android
And in my iOS manifest:
I also tried with AIR 3.5 beta/-swf-version=18. Same issue on both Android and iOS.
Do you confirm that should work? Or am I trying to do something impossible?
Because this page says Bakground "networking". Do that mean only the pre-background loader.load calls are working in background?
With Stage3D, you have to use renderMode direct and as i have mentioned earlier execution in background won't be allowed on Android and iOS in this case.
You might want to raise a feature request for this issue.
Nehgupta, Is it possible to change the render mode during the execution of an application? As in when a user "deactivates"/"activates" the app, can the render mode be switch as to allow background execution?
I am facing the same behaviur, my app work fine in foreground but when I move to backgroud they go to sleep.
When the app go to background I need to execute a http process each 15 secs, i read a lot threads without find any solution.
Anyone have a solution to work a simple http process in background, like how work skype?
I agree it seems to be the case that renderMode can't be programatically changed. What is the reason that Stage3D can't support background location/audio tasks?
It's seriously crap that background execution isn't supported with 'direct' renderMode. Apart from some obscure messages on the forums like this there is nothing I've found to document that this is the case.
Adobe : I would suggest that if AIR is to become a genuine mobile framework this is one of the issues that must be resolved.
I totally agree with you and I advise you to vote and comment the new "feature request" I raised here:
That will encourage Adobe to find a solution.
This should be great but I think adobe isn't work enough to provide a real mobile framework, this lack of information confirm that.
Anyone can suggest me a workaround about the backrgound http proccess for a IOS app ?
I already try a few workaround with the same result, the background process isn't work.
I think isn't possible to run a simple http process in background on IOS.
This is a terrible news for my app because they already work fine on android and playbook but how isn't possible to do on IOS?
Any one have a new suggestion:
So far as I understand it only location and audio updates are available in the background on IOS... you may be able to trick your app into working if you hooked into one of these but it might be a bit of a long shot.
What we're complaining about above is that even though location and audio events are meant to be supported in IOS and Android, when the renderMode is changed to 'direct' this is not the case...
Background processing does not work if renderMode direct is used and it holds true for both iOS and Android.
Please confirm if you have set "NativeApplication.nativeApplication.executeInBackground" to true in your application?
You might want to refer this link for details on AIR iOS background behavior.
This is from adobe : Supporting background tasks on iOS
Adobe AIR 3.3 and higher supports multitasking on iOS by enabling certain background behaviors:
Opting out of background app execution
We thing that networking is the right behavior from our apps but this seems to be for a single taks execution and we need to execute the same process each 15 secs.
Any one have know how execute a http process ech x secs in background using the Networking behavior ?
Any one know if it's possible ?
If you are interested in getting background tasking on iOS/Android when using Stage3D, PLEASE VOTE FOR THE FEATURE REQUEST HERE:
So, after looking at the bug report - the status is now "closed/withdrawn" with the reasoning of "As Designed"?
So Adobe, you designed this problem and have no plans to fix it?
Could we get any type of answer on this?
How could such a big hole in the background processing of the software model be 'as designed'?
I would suggest this may be a big blocker to people using AIR as a platform to develop mobile apps. I know I won't be recommending it until this issue is resolved.
This really is a big bummer and I don't see how this is not a high priority issue, regardless of the implications it may have.
Saying this is "as designed" simply shows that the design has some major flaws.
I've reposted this as a bug... vote for it again if you think its worth the effort.
Actually, I have tested in my app that, on Android at least ( didn't test on iOS ), execution in the background WILL work if renderMode = gpu, but NOT if renderMode = direct.
In other words, direct appears to be the only render mode which prevents background execution. Unfortunately, the direct render mode is necessary for the Stage3D API to work ( which I have also verified ).
Why this is a problem for me ( my use case ):
I am making a graphical alarm clock for Android/iOS, and recently implemented full hardware acceleration via Stage3D. On iOS, I am using local notifications to alert the user when alarm goes off and the app is minimized or closed. Said iOS local notification is scheduled ahead of time, if the alarm has been set, when the app is deactivated.
On Android, unfortunately, I cannot use the same strategy because local notifications on this platform cannot be scheduled ahead of time. Furthermore, with the app minimized and using direct render mode, I cannot trigger the local notification on the spot, while the app is minimized but running in the background. So I am stuck.
The right solution would be:
1) Allow background execution when the direct render mode is used ( preffered ).
2) Use an ANE for the AlarmManager on Android ( none available on the net, as of this writing ).
3) Use push notifications: very heavy handed ( requires server side scripting to schedule the notification ).
I am new to mobile develpment and creating a reminder application for Android & IOS using Flash Builder 4.6, Air 3.1. After surfing on net I got that we need to use ANE for the Alarm manager and Push notifications for the Alerts for Android platform. I am confused for this thing. Is there any simple way to create the application in Android.
Kindly Guide/Refer me for the way to develop background running application in Flash Builder 4.6.
Thanks in advance.
Some of the statements in this thread are no longer true, or need to be updated.
Here is a recap: