Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi,

My app is an messenger client. I want to identfiy when my app is in idle state and change the status of the buddy in the messenger. how do i know the idle state? Can i use EVT_APP_NO_SLEEP event. 

Is there any other way?

 

you may use EVT_APP_NO_SLEEP. but u cannot control the time of showing a user idle in that case.
to control the time, you may setup a timer yourself & re-set it if any key is pressed.
 
//UserIsIdle should be called if no Key or Touch event is received within timems. And the timer will be reset each time a Key or Touch event is received.
 
On Key Event or a Touch Event:
idleTimeout();
//other event handlers
return TRUE; 
 
 
void idleTimeout()
{
ISHELL_CancelTimer(pShell, (PFNNOTIFY)userIsIdle, pData);
ISHELL_SetTimer(pShell, timems, (PFNNOTIFY)userIsIdle, pData);
}
 
void userIsIdle()
{
//User is now idle
}

you may use EVT_APP_NO_SLEEP. but u cannot control the time of showing a user idle in that case.
to control the time, you may setup a timer yourself & re-set it if any key is pressed.
 
//UserIsIdle should be called if no Key or Touch event is received within timems. And the timer will be reset each time a Key or Touch event is received.
 
On Key Event or a Touch Event:
idleTimeout();
//other event handlers
return TRUE; 
 
 
void idleTimeout()
{
ISHELL_CancelTimer(pShell, (PFNNOTIFY)userIsIdle, pData);
ISHELL_SetTimer(pShell, timems, (PFNNOTIFY)userIsIdle, pData);
}
 
void userIsIdle()
{
//User is now idle
}