1. A method performed in a portable electronic device, the method comprising: controlling how hardware sensor output, if any, is available to a process resulting from execution of a software application by a processor of the portable electronic device, as follows: making any hardware sensor output sampled during those time periods throughout which the process is running in foreground available to the process at a higher sampling rate; and making any hardware sensor output sampled during those time periods throughout which the process is running in background available to the process at a lower sampling rate, wherein the hardware sensor output is indicative of orientation or motion or both of the portable electronic device within its environment, and the hardware sensor output is produced by a hardware sensor integrated in the portable electronic device, wherein the portable electronic device comprises a hardware user-input component integrated in the portable electronic device, the hardware user-input component having multiple elements operable to accept user input through touch, and wherein the process runs in the foreground during times when the operating system of the portable electronic device is operable to notify the process of any detected touch events involving the elements, and the process runs in the background during times when the operating system is operable not to notify the process of any detected touch events involving the elements.