Q:

Detect if Android is in a car

I am trying to write an application on Android which requires to detect whether the android is currently in a car or not, using only accelerometers.  Basically the app is suppose to detect if the person holding it is walking or in a car.  For walking I just detected spikes in the accelerometer readings but I am not able to find any characteristic of the car.  How exactly should I approach this problem? 

A:

First of all, the problem as posed is unsolvable - a phone sitting perfectly still in a parked car (or, for that matter, one running at constant velocity) is completely indistinguishable from one sitting on a desk if you restrict yourself to acceleremoter readings. 
For heuristics, I'd just go and record samples, then hone detection algorithms on them.  I assume characteristics for (city) traffic would be bouts of near-constant acceleration over a few seconds totalling up to around 10-20 m/s and somehwat more abrupt decelerations of about the same total velocity.  I don't think you'd be able to integrate accelerometer readings well enough to accurately track something like a car smoothly accelerating to cruise speed, staying there for an hour and then rolling to a standstill over a long stretch, though.  
What are you trying to achieve?