I\'m wondering if I can use (linear) accelerometer and compass to calculate velocity without using location services. I want to do that by calculating acceleration component
In theory, you could do this; in practice, no.
You would have to assume you know an initial velocity, but assuming you start at 0 velocity isn't such a bad assumption.
You would also have to know the actual orientation of the device throughout the whole period. Otherwise you can't differentiate change in acceleration due to actual acceleration versus just rotation the device.
(Remember you have to take out the acceleration due to gravity from the readings!)
Finally, the errors would add up over some time, not only because the measure of acceleration is imperfect, but because you only get discrete samples over time.
Other than all those things, sure, it works! The API does tell you what units the readings are in (m/s^2). You can ask the sensor for very rapid updates. I think it would be interesting to see how (in)accurate it is by writing an app that does this and then putting the phone flat and then walking forward and stopping with it. How close to 0 is the reading then?