The iPhone 3GS uses both an accelerometer and a compass to measure its attitude as well as navigate.
The accelerometer in the iPhone, iPhone 3G and iPhone 3GS is manufactured by STMicroelectronics; for the iPhone 3G and iPhone 3GS, the STMicroelectronics model is LIS331DL, see , of which there are several variation. The LIS331DL can measure from ±2 - ±8 g's.
The iPhone 3GS compass, an Asahi Kasei AK8973S, is made by AKM Semiconductor. The AK8973S uses Si monolithic Hall elements together with amplifier and logic circuitry on a single chip. As an added benefit, the AK8973S also has a built-in thermometer. There's more info here.
iPhone 3G & iPod Touch
It is likely that the iPod Touch 2G (for 2nd generation) accelerometer was the STMIcroelectronics accelerometer. However, there are no actual teardowns that verify such.
How Does An Accelerometer Work?
To understand how an accelerometer works, it is helpful to understand Newton's 2nd and 3rd Laws of Motion. The 2nd Law of Motion explains that the force applied on a body is directly proportional to the rate of change of momentum of the body or mass times acceleration, or F = m a. The 3rd Law of Motion points out that for every action there is an equal and opposite reaction, F = -F.
The accelerometer used in the iPhone and iPod Touch is a three-axis accelerometer that uses springs that face in the x, y and z axe. When the device is moved, a force is exerted on the springs along their respective axes. This data is then used to calculate a change in velocity and in position that the iPod can interpret.
The accelerometer does not depend upon gravity, so your tilt sensor would work on the International Space Station or up in space, a place you will hopefully have a chance to visit one day.
The Blackberry Storm has an accelerometer; the manufacturer and part number are unknown. However, the Storm does not have a compass.