activating times is zero the first sensing module 101 detects if the vibration sensor 11 is activated when the screen 12 is in a locked state in one embodiment the vibration sensor 11 may be a ball switch the ball switch includes a ball and a circuit if the electronic device 1 is shaken the ball may hit the circuit an electric level of the circuit may change if the ball hits the circuit the vibration sensor 11 is activated because of the change of the electric level of the circuit if the vibration sensor 11 is activated the timing module 102 reads a first system time of the electronic device 1 the counting module 103 increase a present value e g the initial value of the activation times of the vibration sensor 11 by one and obtains a first value of the activation times the first detecting module 104 calculates a difference between a second system time of the electronic device 1 and the first system time of the electronic device 1 and detects if the difference is the same as a predefined value if the difference is different from the predefined value the second sensing module 105 detects if the vibration sensor 11 is further activated if the second sensing module 105 detects that the vibration sensor 11 is further activated the counting module 103 increases the first value of the activation times by one and obtains a second value of the activation times if the difference is the same as the predefined value the second detecting module 106 detects.