Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API to find out if application is currently active #13

Open
PrimaryFeather opened this issue Aug 7, 2017 · 2 comments
Open

Add API to find out if application is currently active #13

PrimaryFeather opened this issue Aug 7, 2017 · 2 comments

Comments

@PrimaryFeather
Copy link
Contributor

Feature Request

The NativeApplication class allows to listen for "Event.ACTIVATE" and "Event.DEACTIVATE" events. That way, it's possible to find out if an application is currently active. However, this only works if an application starts to listen for these events right from the beginning.

As a library developer, I can never know when my library is first used — thus, if my library is first invoked while the application is in the background, I can't know about that.

Thus, it would be great to have an API like nativeApplication.isActive that tells me about the current status.

Adobe Tracker: https://tracker.adobe.com/#/view/AIR-4198418

@ajwfrost
Copy link
Collaborator

@PrimaryFeather I've only just seen this issue/request .. was just wondering, looking at how the activation messages happen, would you not be able to tell this just from the NativeApplication.activeWindow property?

https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeApplication.html#activeWindow

Or .. presumably the above would only work on desktops, are you looking for this also on mobile? It shouldn't be too tricky if we just add an internal flag for this based on the events that have been dispatched...

@PrimaryFeather
Copy link
Contributor Author

PrimaryFeather commented Mar 29, 2022

Hey @ajwfrost!

Or .. presumably the above would only work on desktops, are you looking for this also on mobile?

I must admit I can't remember if I looked at the activeWindow API back when I created this issue; but in any case, the main target I was thinking about was mobile, yes.

The main reason I brought it up was because there are some Stage3D APIs that must not be called when the app is running in the background. If I could query the current state, I could avoid those calls altogether and wait for the app to come into the foreground again.

Thanks a lot for considering such an addition! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants