How to disable IDLE timer

Hi!

I want to disable idle timer in my game. I do not want my game to fade out after some time after last touch event.

Can anyone help me please?

It depends on what system you’re using.

I don’t know about iOS, but if you’re using Android, you can use the following method (or XML attribute) to keep the screen from fading out:
http://developer.android.com/reference/android/view/View.html#setKeepScreenOn(boolean)

However, I would not recommend doing that. It’s very bad behavior because the user expects his/her device to automatically turn off (making your app go into a paused state).

Think about what happens if he/she puts the device into some kind of bag or whatever and forgets to actually turn it off while playing your game. The result could be an empty battery if he/she gets the device out at a later point of time.

Thanks for your reply.

I am using Airplay SDK and I did not have this problem on older version of cocos2dx.
The concept of my game is next:
User input query and then he wait until the game show the results of his action.
So the game is waiting for 10s and in the mean time application fade out.

First off all i am sorry for spamming :wink:

The solution is to put

s3eDeviceBacklightOn();

in:

int CCApplication::Run()
{
……
while (!s3eDeviceCheckQuitRequest())
{
s3eDeviceBacklightOn();

You can also set the fade out time to be (temporarily) a bit longer. That way, you won’t burn the user’s battery, even if by accident :slight_smile:

Don’t know how to do that with Airplay though, sorry.

Hi, Mile, I saw you have found the solution.
May I move this post into airplay subforum? You experience will help others using airplay port :slight_smile:

yes of course!