I have an android game and sometimes, when I send it to the background and it regains focus, it stops responding (causing an ANR).
I am unable to debug the problem on android, and now I am wondering if there are probably some standard things I should do …
It seems, the bug is only caused when in the main game, not in the menu. In the main game a lot of animation is going on (via actuate and reacting to ENTER_FRAME).
Should I somehow react to “ACTIVATE” and “DEACTIVATE” events?
How? Should all my objects remove the “ENTER_FRAME” event while inactive? How can I tell actuate to pause?
Or what is the standard thing to do, when the app is deactivated?
What version of Lime? Is it -Dlegacy, or not? Does it make a difference if audio is playing?
Actuate can use
Actuate.resumeAll to freeze action between
lime version 2.4.4
openfl version 3.1.0 with -Dv2
audio is only playing short wav files from time to time, but not at the time of pausing/resuming. So I guess it does not make a difference.
I really would like to debug the problem, but I can not get gdb no hxcpp-debugger to work on android.
Does this occur with any of the OpenFL samples?
No, but I just realized that I can produce the ACTIVATE and DEACTIVATE events on desktop too. And there the debugger works. Doing so I found out that my app goes into an infinite loop. It seems to have to do with timestamps coming from haxe.Timer being to far apart.
So it is, as expected in my code and now I can debug it :-). Thanks!
If you use Actuate, you can also use
Actuate.pauseAll () and
Actuate.resumeAll () when these events occur, might be handy