I am using the UIAccelerotmeterDelegate method accelerometer:didAccelerate: but recently that method has been deprecated in iOS 5.0. So what is the alternative way
You should use the Core Motion framework (introduced in iOS 4.0) as a substitue. Create an instance of CMMotionManager and tell it to startAccelerometerUpdatesToQueue:withHandler:, passing it an NSOperationQueue and a block that will be executed on the specified queue whenever new accelerometer data is available.