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
[Android] Event.DEACTIVATE does not fire when opening task list #2772
Comments
Hi We're not able to reproduce this with a basic SWF on Android 13, we're getting the Event.DEACTIVATE message when we just push up the bottom of the screen to display the task list... Are you able to confirm what handset(s) you've tried this on, and maybe provide a quick test file that reproduces the issue? thanks |
The device we tested was the Pixel 6a. We also took a video showing the problem. android_task_list.mp4Attached is a simple project used for testing. |
On Pixel 6a, where we observed this problem, we found that OnApplicationPause() was not being called and data saving was not happening at the timing we expected, even for Unity apps. Then I found the following post. And taking a cue from this post, I incorporated OnApplicationFocus() and the Unity app now receives a notification that it has lost focus on the Task List screen. https://gamedev.stackexchange.com/questions/191550/saving-settings-when-exiting-the-application I thought that using the same Focus event in AIR would solve the problem, but the documentation below says that the event for losing focus in AIR is "deactivate". https://help.adobe.com/ja_JP/as3/dev/WS5b3ccc516d4fbf351e63e3d118666ade46-7e07.html Hmmm. Is there any way to do this? |
Thanks for the investigations there .. so it looks like there's an alternative Android event that's being sent, that we'd need to hook into to make the deactivate/activate events fire in these scenarios. We'll see if we can check and incorporate this (and will see about testing on a Pixel 3 or 6a..) |
We are going to start working on updating about 90-110 apps next week to be compatible with Android 13 (API Level 33). If it were not so difficult to deal with the new Focus events, I would prefer to use the AIR SDK with it's updated version. It would be great to get information by next week on the status of the confirmation and the release schedule. |
Okay thanks -> it looks like we can handle this by adding a listener for onTopResumedActivityChanged We should be able to do this fairly swiftly, the logic to handle both this and thanks |
Thanks for the reply. |
Resolved in 50.2.3.5 |
I tried 50.2.3.5. |
@takazawa-gg it should still be the 'deactivate' event.. if you're not receiving that, then either we've got a bug still, or the device isn't sending the expected lifecycle event. Do you have a Pixel 6a you can try this out on? We were using a 6a from AWS Device Farm and it worked okay there, but there may be differences in the software builds I guess. If you have Android Studio, would you be able to do some testing/debugging for us to see what may be happening? If you are able to build a test app that just listens out for the activate/deactivate events, and does a "trace" output or similar (or pauses the animation?) - in debug mode - then could you package this using the command:
This should create a folder in which there's an Android Studio project that you can then open in Android Studio. If you then open the app/java main class (your application ID as the package name, and then "AIRAppEntry") - you should be able to then add a bit of Java within this class:
Then if you connect your Pixel 6a and hit the "debug" button, it should build this and deploy it onto your device. You can then hopefully see whether the above function is being called when you bring up the task list. thanks |
I tried debugging.
IMG_7172_10.mp4 |
@ajwfrost |
Hi We have some concerns with using the window focus event to determine whether the application is active or not .. as the window focus will seemingly also be triggered in a number of other situations where you actually would want the AIR application to continue running. So we may have to look at a different option here.. We can do a test build though and upload the ADT jar file that would be able to make a change to handle your scenario above, it would be good if you're able to then see what side-effects there are (e.g. when browsing for files or showing any kind of pop-up messages, requesting permissions for things, etc). I'm wondering whether a better option - for the longer term - would be to have NativeWindow support on mobiles, as this then would be a property/event for the window itself rather than the application. The application/activity here is still very much active and in the foreground, from Android's lifecycle perspective, even though the window hasn't got the input focus any more... thanks |
@ajwfrost, about |
@itlancer yes that kind of thing was also at the back of my mind too :-) Android (and to a lesser extent, iPadOS) is starting to move towards providing a more "desktop" type experience! |
@ajwfrost The primary use of the focus event in our app is to trigger a data save. For this purpose, it would serve its purpose if it could receive independent Event.FOCUS events. What do you think? |
@ajwfrost What happened to this issue? If a focus event is not available, we must consider an alternative approach. Please consider. |
Hi @takazawa-gg - apologies for the delay, we had actually created a test build with the Android window focus event also going in to trigger the activate/deactivate events. So perhaps until we have a separate NativeWindow support per the above comments, this would work instead? thanks |
@ajwfrost P.S. I hope the recent Unity Fee issue will bring AIR back into the spotlight! |
after update to latest air skd (that address this issue) my app get black screen when i do several actions on my android phone. Some examples: go to task list and open app again remove the blackscreen and show the game again, but executing any of the examples above trigger blackscreen again. |
Rolling back to 50.2.3.5 resolve the problem. |
Just wanted to make a comment here, I don't believe the DEACTIVATE event should be dispatched when the application drawer / list is displayed. Most applications are expected to continue to run here on Android and a native application doesn't get the activity lifecycle "pause" event which I believe the deactivate event should mostly mimic. |
Seems we need two different events for mentioned cases. And developer can decide which to use. |
Agreed, I think there should be some "focus" type event alongside the existing activate ones. |
Event.DEACTIVATE does not seem to fire when opening the task list on a device with Android 13.
In our app, we were trying to set fps to 0 or save data when deactivate was detected, but in Android 13, the app animation continues to play even when the task list is opened.
Animation stops on devices up to Android 12.
Can you confirm if this is a specification or unexpected behavior?
We are checking the operation with AIR SDK 50.2.3.2.
The text was updated successfully, but these errors were encountered: