Store the last 30 samples of the accelerometer, get per-component averages (x, y, z) and standard deviation for each. Define how little deviation is "stable".
Obj-C: Calculate the standard deviation of an NSArray of NSNumber objects?
That will do. Make 3 arrays, each will have 30(or more or less depening on the time frame you want to compare) nsnumbers. You will get 3 standard deviations. The smaller those numbers are, the less the device is moving. Check that the 3 of them are smaller than any arbitrary amount you want, like 0.1.s