Idle Timer/Suspend on android

Hi,

On android when the device sleeps on an idle timeout, it wakes up fine where the game last left off.

When it suspends it restarts the game with a ‘resume’ event. Suspend happens when you get a phone call OR use the power button to put the device to sleep OR wake it.

I’m not interested in handling the suspend event as its quite complicated to save and reload all my resources in exactly the same place, but at a minimum sleep needs to work.

On the Nexus on however, the only way to wake the device from sleep is to use the power button which actually triggers a ‘resume’ and restarts the game :frowning:

setidletimer isnt working on android either, so I cant event prevent sleep totally - which would be an acceptable solution.

At present my game is not really releasable in this state. On my Nexus one for example I use a idle time of 1 minute and if i put the phone down to quickly do something else, it ruins my game experience when i come back to find it asleep and the game restarted.

Any ideas at all how to deal with this? Disabling the sleep timer would be good enough [import]uid: 8872 topic_id: 6178 reply_id: 306178[/import]

Hi,

We’ve confirmed the issue with setIdleTimer() not working properly on Android. I’ve filed internal bug #3429 to track. Thanks for your patience.

Tim [import]uid: 8196 topic_id: 6178 reply_id: 21572[/import]

Any update on this? I’m due to publish my app in the next 3 days :confused: [import]uid: 8872 topic_id: 6178 reply_id: 22279[/import]

We’re looking into this, but there appears that Android has a lot of problems and many devices don’t correctly work with this. Example:

http://stackoverflow.com/questions/2039555/how-to-get-an-android-wakelock-to-work

We are investigating what we can do to work around these problems. But I’m afraid 3 days might be too short for this.
[import]uid: 7563 topic_id: 6178 reply_id: 22289[/import]

Thanks. I appreciate the update.

It may be better if I delay the android release for a week then. I understand it takes time to fix, and there’s nothing you can do about that. Please let me know if/when you find the solution

Thanks again [import]uid: 8872 topic_id: 6178 reply_id: 22453[/import]

Hmm I checked the resume/suspend events and this is what i’m seeing:

start app:
I/Corona (10648): applicationStart

Suspend:
I/Corona (10648): applicationSuspend
I/Corona (10648): applicationExit

Power button to wake up: (on the lock screen)
I/Corona (10648): applicationStart

Swipe to unlock:
I/Corona (10648): applicationSuspend
I/Corona (10648): applicationExit
I/Corona (10648): applicationStart

There’s no resume event at all.

Alternativly:

Start app:
I/Corona (10842): applicationStart

Press HOME button:
I/Corona (10842): applicationSuspend

Reopen APP
I/Corona (10842): applicationResume

In this case, the app restarts where it left off. I think the fastest solution is to disable the idle timer. So this is back to urgent for me :frowning:

[import]uid: 8872 topic_id: 6178 reply_id: 22763[/import]

I pushed some stuff today for this. Try build #298 (or later). You do not need to set the WAKE_LOCK permission if you were trying that.

[import]uid: 7563 topic_id: 6178 reply_id: 22854[/import]

Hmm idle timer still doesn’t work. Screen locks as normal.

What phone/OS version do you have it working with?

I’m just calling this at the beginning of my code.

system.setIdleTimer( false ) – disable (turn off) the idle timer

[import]uid: 8872 topic_id: 6178 reply_id: 22881[/import]

BTW is there a particular group you are turning this flag on for? I have a full screen filled rectangle with alpha set to 0 and is-hit-testable switched on, Could that be affecting it? [import]uid: 8872 topic_id: 6178 reply_id: 22882[/import]

I think I goofed and flipped the booleans. Setting to true will block screen locking. False returns to normal behavior. Let me know if that’s the problem. I’ll flip the flags next time I get a chance if that’s the problem.
[import]uid: 7563 topic_id: 6178 reply_id: 22883[/import]

Yep that works!

Good job :slight_smile: [import]uid: 8872 topic_id: 6178 reply_id: 22888[/import]

BTW on the daily builds, it would be nice if you could put debug prints like below inside debug defines, and did the daily build as release.

V/Corona ( 1198): ****** ACTION_DOWN: CLEARING ********
V/Corona ( 1198): ***** onTouchEvent(2) *****

I’ll be releasing my game using 298 probably because of the idletimer fix, but it spams logcat with all those touch events which isn’t ideal.

[import]uid: 8872 topic_id: 6178 reply_id: 22889[/import]

Would you please submit a bug report on the debug prints so we don’t lose track of that?
[import]uid: 7563 topic_id: 6178 reply_id: 22903[/import]

Submited # 3572 [import]uid: 8872 topic_id: 6178 reply_id: 22977[/import]

I flipped the booleans around. Expect to see the change in build 301.
[import]uid: 7563 topic_id: 6178 reply_id: 23349[/import]

Great, have been looking out for it in the release notes. Am using 300 now. [import]uid: 8872 topic_id: 6178 reply_id: 23351[/import]

I am using build 484 and am seeing this behavior. To restate, when I exit the app by pressing the home button and then relaunching the app, everything behaves as expected. When the device suspends and then is powered on again, the app starts over from the beginning. I am using a 7" Galaxy Tab.

An additional twist is that before the device is even unlocked, I begin to hear audio that plays when the app starts, which is kind of a problem, it seems to me.

Thanks,
Adrian [import]uid: 3671 topic_id: 6178 reply_id: 47360[/import]

I am experiencing the same problem as acrowne. I must release the Android version today but I am not really happy with it. I have a video at the start of the app. So the bug on suspend and the bug of the video restarting each time the device is turned will immediately give the user a wrong impression… please please help on this [import]uid: 68130 topic_id: 6178 reply_id: 50882[/import]