I want to trigger an action in case mobile screen idle for some time?

I want to trigger an action in case mobile screen idle for some time?

  

Hi All,


I want to trigger an action in case mobile screen  idle for some time?

The requirement is I need to set idle time for mobile  screen and after screen idle time over  I need to trigger an client action to show user some message.


Please suggest some approach.


Thanks


Hi Dileep,


To do that, you can do the following:

  1. Create a block with an input parameter for the idle time in seconds
  2. Create an event on the block, let's say "IdleTimeReached"
  3. Create a client action on the block, in wich you trigger the event you've created previously
  4. Now you define an action to handle the OnInitialize of the block, in wich you will define a Timeout. To do this, inside the OnInitialize action use a javascript with an input parameter for the idle time, setting the handler as your previously created action wich fires the event "IdleTimeReached". The javascript should be something like this: setTimeout($actions.Firetimeout(),$parameters.Idletime*1000);
  5. So now you just have to add this block in the screens in wich you want the described behaviour, and set an action as the event handler showing the user the message.

Hope this was helpful, let me know if it worked :)


Best regards,

Daniel


Daniel Duarte wrote:

Hi Dileep,


To do that, you can do the following:

  1. Create a block with an input parameter for the idle time in seconds
  2. Create an event on the block, let's say "IdleTimeReached"
  3. Create a client action on the block, in wich you trigger the event you've created previously
  4. Now you define an action to handle the OnInitialize of the block, in wich you will define a Timeout. To do this, inside the OnInitialize action use a javascript with an input parameter for the idle time, setting the handler as your previously created action wich fires the event "IdleTimeReached". The javascript should be something like this: setTimeout($actions.Firetimeout(),$parameters.Idletime*1000);
  5. So now you just have to add this block in the screens in wich you want the described behaviour, and set an action as the event handler showing the user the message.

Hope this was helpful, let me know if it worked :)


Best regards,

Daniel


I'm sorry, I forgot to mention that you'll have to set a handler for events that interact with the screen, resetting the timeout. You can follow this article that shows you how to do that.


Regards,

Daniel