7 Replies Latest reply: Oct 21, 2012 7:26 PM by Spedronimo RSS

    AIR + iOS + geolocation updates + screen off = FAIL


      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.