Patent ID: 8924252

Claim:
A method of displaying an advertisement on a display screen of a communication device, the communication device including a processor and a memory including program code defining a function library and an application program, the application program including a plurality of activities associated with a plurality of display windows rendered by the display screen wherein ones of the activities transition between a foreground state and a stopped state prior to finishing execution, the memory further including an operating system providing an interface between the application program and at least the processor and the display screen, the processor performing the method by executing the program code, the method comprising: receiving an indication of occurrence of an operating system event wherein the operating system event is associated with an activity termination routine of the operating system and is indicative of a state transition of a first activity of an application program being executed on the processor wherein the state transition indicates that the first activity is one of finishing execution and transitioning to the stopped state; invoking, by the function library in response to the indication, an activity finishing routine of the operating system wherein the activity finishing routine is different from the activity termination routine and wherein the activity finishing routine is configured to interrogate at least a portion of the operating system and to determine a cause of the operating system event; determining, based upon the cause of the operating system event, that the first activity is finishing execution and not transitioning to the stopped state; and displaying, upon determining the first activity is finishing, the advertisement upon the display screen upon further determining that the communication device is operating in accordance with one or more predetermined conditions.