3 Replies Latest reply on Oct 12, 2011 10:30 PM by syed mehadi

    Air 3.0 multitask features for ios

    Haitao LIU



      My app needs to update it's status to my server, when it goes to background.


      Currently I'm using Air 2.7, and do a curl by listenning deactivate.


      It works fine on Android, but can not finish the curl on ios after home button is pushed(the event is fired, but the curl seems never be executed).


      Is there any way can do this job on ios? How about air 3.0 multitask features for ios?

        • 1. Re: Air 3.0 multitask features for ios
          Saumitra Bhave Level 3



          As part of background behaviour AIR 3 now supports Background Mode Audio(see<http://www.adobe.com/devnet/air/articles/air3_whatsnew.html>). You can define it using the (UIBackgroundModes key in infoAdditions in app descriptor) see http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyRefere nce/Articles/iPhoneOSKeys.html for how you can define UIBackgroundModes. This will allow your app to run in background if it plays Audio. Still I am not sure if this will work for you as I am uncertain about the review guidelines. (I think if you say UIBackgroundModes Audio your app needs to provide Audio related services.Not sure though!!. Please confirm yourself before taking this approach) . Please note that Audio is the only background mode that AIR 3 supports currently.

          • 2. Re: Air 3.0 multitask features for ios

            I can confirm that defining the UIBackgroundMode for 'audio' allows you to run code while the app is in the background.  I have a similar issue I am trying to solve, but with regards to location.  I need to be able to receive geolocation updates when the app is active, at the home screen, while in another app and when the screen is turned off. I have gotten it to work with all of the cases except for while the screen is off by defining the UIBackgroundmodes for both 'audio' and 'location'.


            To test if code can be run, I have an event listener that gets triggered when the app is deactivated and activated.  I am setting a timer the moment the app gets deactivated and incrementing a varaible every 100 milliseconds while the app is inactive.  When the app becomes active again I report the number back in a debug textfield.  If I press the home button or open another app, the number is accurate to how long the app was inactive for... but as soon as I press the power button to shut the screen off, the number stops incrementing shortly after.


            I have seen plenty of native iOS geolocation-based apps get updates while the screen is off, why is this not the case for an AIR iOS app? Is there a workaround for this? Does someone at Adobe need to fix this issue?  At this point, I'm not even sure Native Extensions would do the trick...


            ANY help would be greatly appreciated.

            • 3. Re: Air 3.0 multitask features for ios
              syed mehadi Level 2

              Please file a bug detailing all these issues and some sample code at: http://bugbase.adobe.com