Skip navigation
Ferro_B
Currently Being Moderated

AIR + iOS + geolocation updates + screen off = FAIL

Oct 5, 2011 6:57 PM

Tags: #air #background #adobe #mobile #ios #geolocation #location #multitasking #uibackgroundmodes

Where do I start... I have been trying to tackle this issue for quite some time now and every time I think I have the answer something else comes along to crash the party.

 

I am in the process of building a multi-screen AIR mobile application with the AIR 3.0 SDK that records geolocation updates as they are sent from the device.

 

Everything works fine on Android but when I test on iOS here are my findings...

 

Geolocation updates work fine while the app is active.

 

In order for you app to be eligible for background services you need to set the UIBackgroundModes in your app-xml file for the service you would like to enable... in my case 'location' (which I did)

 

I found that doing this alone will not allow you to receive the location updates when the app is in the background. As soon as the app is "minimized", it goes into a suspended state and no code is being executed until the app beomes active again ...therefore none of the location updates are received.

 

I found that setting the 'audio' AND 'location' values together somehow allows me to run code while the app is in the background, just not while the screen is turned off.  The moment you press the power button to turn the screen off, the app goes into a suspended state again.

 

To test if code can be run, I have set up 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 variable 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 dectivate the app by pressing the home button or open even open another app, the number that gets reported back when I go back to my app is accurate... 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 location 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... Am I doing something wrong?

 

ANY help would be greatly appreciated.

 

Thanks!

 
Replies
  • Currently Being Moderated
    Oct 12, 2011 4:01 AM   in reply to Ferro_B

    Hi:

     

    The issue you are facing on iOS is because of the known bug where there are no events fired when the screen is off(including the time events). This bug will be fixed in future releases. I will take care of posting on this thread when the release with this fix is out.

     

    Thanks for posting.

     

    Regards,

    Saumitra Bhave

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 12, 2011 9:11 AM   in reply to Ferro_B

    It's "days". But quite a lot of them.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 8, 2011 10:47 PM   in reply to Colin Holgate

    I am developing a music app and I must do transitions between songs, even if the device's screen is off.

    I really need this adobe Air improvement. Have more informations today ? Could you tell me when it will be released ?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 19, 2012 9:01 AM   in reply to Ferro_B

    I think it was corrected with AIR3.3, BUT it is still there when you set renderMode to "direct".

    Annoying.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 21, 2012 7:26 PM   in reply to Colin Holgate

    Has this been fixed? This still appears to be broken in 3.5 Beta exactly as described above here...

     
    |
    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