Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
sho3ebovich
Posts: 120
Registered: ‎12-22-2011
My Device: ---

Check Idle State of the device

How can i check the idle state of the device .

in other word how can i check if the user not touch or make and action on devcie for specific period .

 

 

Thanks.

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Check Idle State of the device

Something like this?

 

    /**
     * Determine if device is idle. We define this as "inactive for 30 seconds"
     * This is used to avoid any background processing that would noticeably
     * slow the unit down. If the device is idle, we probably won't disturb the user.
     * @return true if idle
     */
    public synchronized boolean deviceIdle()
    {
        if (DeviceInfo.getIdleTime() > 30L)
            return true;
        else
            return false;
    }