A method and apparatus for monitoring and/or managing adherence to a medication regimen that involves use of a sensor. Dispensing medicine from a container commonly involves motion of the container, which can be a distinctive motion. In some embodiments, a processor monitors motion sensor data from a motion sensor that is physically coupled to the container, such that the motion sensor and the container move in unison. A processor analyzes the sensor data to determine physical movement of the container. When the determined movement matches the distinctive motion of medicine being dispensed, the processor can determine that medicine has been dispensed. A computer system can compare the dispensed medication to a planned medication regimen to determine a state of compliance to the medication regimen. The computer system can take an action based on the compliance state, such as sending a message indicating the compliance state to a medical professional.