This code is only concerned about the magnitude of the shaking. You might want to make it sensitive it to a specific direction (e.g. up and down) to allow for the possibility of other shake gestures, e.g. left-to-right.