Problem restoring game?

Monkey Targets Forums/Android/Problem restoring game?

SLotman(Posted 2014) [#1]
I'm on Monkey 77b - and my game is working fine on Desktop.

On Android, however, if I hit "home" then run my game again - it freezes.

Trying to debug it, made me even more lost: when first running the game, everything works fine, and this is the debug I put showing when OnUpdate and OnRender are called:

I/[Monkey](11161): master: onRender
I/[Monkey](11161): master: onUpdate
I/[Monkey](11161): master: onUpdate
I/[Monkey](11161): master: onUpdate
I/[Monkey](11161): master: onRender (and it goes on like this)

But, after I hit the home button, and starts the game again... this is what I get:
I/[Monkey](11161): master: onUpdate
I/[Monkey](11161): master: onUpdate
I/[Monkey](11161): master: onUpdate
I/[Monkey](11161): master: onUpdate
I/[Monkey](11161): master: onUpdate

OnRender is not being called anymore...?! What is going on here?!?


SLotman(Posted 2014) [#2]
That's weird. The problem only happens on Bluestacks emulator - and just with this game!

Others I developed with Monkey (Escape from Alcatraz, Detetive Carioca 2) doesn't have this problem... and the weirder thing is I'm not doing anything fancy!

Even weirder, its that sometimes it works. But most of the time, it doesn't and I get no error to debug, nothing.

Edit: and the game keeps running normally on background - I can even start it and hear sounds being played - but no screen being rendered?!


Aman(Posted 2014) [#3]
How are you handling OnResume() and OnSuspend() ?


AdamRedwoods(Posted 2014) [#4]
are you reloading your textures after an OnResume?


SLotman(Posted 2014) [#5]
AdamRedwoods: Never had to reload textures on OnResume... but even doing so (I tested it) it doesn't matter - OnRender is not being called anymore, so nothing gets drawn!

Take a look at the game here: https://play.google.com/store/apps/details?id=com.icongames.WhenPigsFly
I don't have a (recent) android phone/tablet to test it on, just an old 2.2 device - and it is so slow (just like the official emulator) it never fails. But on Bluestacks, it fails most of the time (which is weird!)


bazmonkey(Posted 2014) [#6]
Is reloading all textures generally accepted as the thing to do after OnResume? (on android). I couldn't find a clear/official page on it -- seems important…(!).


SLotman(Posted 2014) [#7]
I never did anything like that, on any target. Only target I need to restore textures was on GLFW, but that when I swap between fullscreen/windowed mode.