The method proposed in this paper utilizes the front and rear cameras of a user’s smartphone to distinguish drivers from passengers to prevent texting-while-driving. Since texting behaviors of drivers differ from those of passengers, the images captured by the front and rear cameras on a smartphone have distinguishable characteristics. These features can be cost-effectively employed to detect whether the smartphone is being used by the driver or a passenger. Our experimental results show that the accuracy of the proposed scheme is over 92% among most of the testing cases, which makes the proposed system a cost-effective tool for automotive safety via smartphone cameras.