Reinier
Reinier

Reputation: 108

How to disable background execution of Adobe AIR app on Android?

I am developing a couple of Adobe AIR apps for Android. An issue I encounter is that execution of the app continues when the app is in the background, for instance when the user presses the device's home button. The framerate drops to about 2 fps, but audio and timers just continue.

I need the app/script execution to pause when not activated. I don't want timers, audio, timelines etc to continue. Pausing/resuming them all myself on Event.DEACTIVATE/Event.ACTIVATE is not really feasible, due to the complexity and structure of the apps.

I have tried explicitly setting 'NativeApplication.nativeApplication.executeInBackground = false', with no effect. There is nothing in my manifest xml that does anything with background execution.

I am using Adobe AIR 16.0. I have tested on Samsung Galaxy Note 10.1 2014, Samsung Galaxy S4, which both run Android 4.4+

On stackoverflow I see a number of questions asking the opposite, so this behaviour seems odd.

Thanks!

Upvotes: 1

Views: 1710

Answers (1)

gabriel
gabriel

Reputation: 2359

You can monitore these events: Event.ACTIVATE and Event.DEACTIVATE to know when the application is activated or deactivated (background)

NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, function(event:Event):void
{
    // activated    
});

NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, function(event:Event):void
{
    // deactivated
});

Upvotes: 3

Related Questions