Jump to content

Keeping the user active even when the screen is locked

Recommended Posts

I have a small online question and answer game. In which once a leader starts games, on particular time duration it goes on till he exits from the game. But when the leader's screen is inactive (both in mobile and laptop as well) / locked, the game stops, it doesn't work. How can i overcome this problem?

i have not used cookies so far. is the cookies solve my problem? or any other way please suggest

Link to post
Share on other sites

Don't lock your screen?  :happy-04: 

I'm not sure you've given much of the needed information.  What does "the game stops" mean?  "It doesn't work" is rather nebulous.  Are error message produced?  If the screen is unlocked, does the game resume?  Is this game written in PHP?  If not ... are you in the correct forum? 

Link to post
Share on other sites

i am using php and mysql.

1. Leader starts the game, a flag is set to 1 in database and players will see the questions (Only this needs Leader's click)

2. After 40 seconds, result will open in leader's side and the result flag will set to 1 and players will see the result. 

3. After 40 seconds, it will go back to questions and same thing happens


Leader will just starts the game and his work is done. Till he exists the game, it should be running.

Here if the leader is inactive , the flag won't set and player have to wait till leader is active.


I don't know how to overcome this

Link to post
Share on other sites

The problem your having shouldn't exist, so you'll probably have to start showing some code to get any help.


For starters, how are you doing your timing? The only way your issue makes sense would be if you're doing the timing on the leader's browser using javascript and their machine ends up going to sleep. Just having the screen-saver / lock screen activate shouldn't cause any problems.

Link to post
Share on other sites

Yeah, i am using javascript to submit form to set flag in leader's end like this

<script type="text/javascript">
 $(function(){  // document.ready function...

And in result page

header( "refresh:25;url=play_game.php?id=".$grp_id."" );  
Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.