detect shake event on android

Hi i have readed here[[http://stackoverflow.com/questions/5271448/how-to-detect-shake-event-with-android]] how to make it, but i found the same function on cocos2dx template in a accelerometer .java file.
I’m new to this, so, not to make damage, there is a way to detect shake movement of the device?
thanks