Skip navigation
Currently Being Moderated

Background Behavior for iOS - the Suspend event and executeInBackground

Apr 6, 2012 12:10 PM

It looks like suspend is not being defined in airglobal.swc. It just says (line 836 of flash.events.Event.as):

 

public static const SUSPEND : String;

 

Also, when attempting to compile in, ah, Flash CS<NDA> with "AIR 3.3.0.3230 for iOS" as the target, adding <executeInBackground>true</executeInBackground> to the app xml's <iPhone> node results in an alert:

 

Unexpected or unknown element or attribute in the application descriptor file.

  application.iPhone.executeInBackground is an unexpected element/attribute

 

Is there any way to test these things with this beta?

 
Replies
  • Currently Being Moderated
    Apr 6, 2012 8:34 PM   in reply to random(1)

    It happens to me as well. I did try to put this variable in flash coding, but I need try {} catch to be able to test in flash builder otherwise it crash with no error appear.

     

    try {

        NativeApplication.nativeApplication.executeInBackground = true;

    } catch (e:Error) {

    } //Without try catch.. Flash builder crash at this line with no error notification. But in iPhone4 without try catch it runs fine

     

     

    However, when I test my application in iPhone4 iOS 5.01, I got nothing when the app is in background (I tested by firing post variable via url loader to server with enterframe event 40-50 frame once, and  by add location update event listener to Geo object also).

    I think the problem is <executeInBackground>true</executeInBackground> which is added to <iPhone> tag in app.xml can't be compile by flash builder.

     

    note: I've also changed application description to air 3.3

    <application xmlns="http://ns.adobe.com/air/application/3.3">

    and added location service in

     

    <InfoAdditions><![CDATA[

                                  <key>UIDeviceFamily</key>

                                  <array>

                                            <string>1</string>

                                            <string>2</string>

                                  </array>

                                  <key>UIBackgroundModes</key>

                                  <array>

                                            <string>location</string>

                                  </array>

      ]]></InfoAdditions>

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 7, 2012 6:58 AM   in reply to wissarut

    Yep same problem here,

    tried ADT compilation using ComandLine, and "<executeInBackground>true</executeInBackground>" won't process, no matter what

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 20, 2012 3:14 PM   in reply to random(1)

    The same here. Tryed this:

     

    <iPhone>

        

            <InfoAdditions><![CDATA[

                                  <key>UIDeviceFamily</key>

                                  <array>

                                            <string>1</string>

                                            <string>2</string>

                                  </array>

                                  <key>UIBackgroundModes</key>

                                  <array>

                                  <string>location</string>

                                  </array>

      ]]></InfoAdditions>

      <requestedDisplayResolution>high</requestedDisplayResolution>

      <executeInBackground>true</executeInBackground>

    </iPhone>

     

    Got this:

     

     

    Error occurred while packaging the application:

     

    /private/var/folders/hS/hSnReJAjFeuPVy-AYoffRE+++TI/-Tmp-/AOT133495998 3779/NativeiOSMaps-app.xml(271): error 103: application.iPhone.executeInBackground is an unexpected element/attribute

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 20, 2012 9:39 PM   in reply to Cabana Criação

    executeInBackground exists only as a property and not as a tag in the descriptor xml.

                http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/ 3/whatsnew.html

     

    -romil

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 23, 2012 10:36 AM   in reply to Romil Mittal

    Thansk for the reply Romil.

     

    That is what I thinked. But

    NativeApplication.nativeApplication.executeInBackground = true;

    dispatches a runtime error.

    It seems to be impossible to get the app running in background throwing the user location.

     

    Do you have any working example?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 25, 2012 2:51 AM   in reply to Cabana Criação

    Hi Cabanacriacao,

      Have you verified that you are using swf-version 16 .

    If not then please add -swf-version 16 in Flex compiler settings . executeinbackground property will only works with swfversion 16

     

    -Ashish

     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2012 8:53 AM   in reply to gang_war

    Thanks Gang. It worked now. But it was for another reason.

     

    I am building an App that uses a Native Extension of GoopleMaps iOS API.

    ( http://code.google.com/p/air-maps-ane/ )

     

    I was relying on the Native GPS event. And I am pretty sure it doesnt work in background doesnt matter how you set your app descriptor.

     

    When I switch to as3 Geoloaclization events, it just started working.

     

    Do you know if there is any conditions to use the background behavior with Native Extensions?

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2012 10:04 PM   in reply to Cabana Criação

    Could you please confirm if you have set the “NativeApplication.nativeApplication.executeInBackground” to true in Action script code and “UIBackgroundModes” tag to “location” in iPhone section of application descriptor?

    If either of this information is missing from your app, please try running the app after adding them and do let us know the result.

     

    -Neha

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 9:14 AM   in reply to random(1)

    Yeah, I am sure.

     

    It works perfectly when I use Flash Geolocation event.

     

    But when I rely on the Native GPS event from the Native Extension, the GPS arrow simbol disapear at the very moment I get out of the app.

     
    |
    Mark as:
  • Currently Being Moderated
    May 8, 2012 2:20 AM   in reply to Cabana Criação

    Could you please share the source code of your app?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points