Other Times Your Application Is Called

You know how an application works within the OS and now you know about the organizational structure and content of the various source files used to create an application. The last remaining piece of the puzzle is other times the OS communicates with an application. Let’s turn to the details of this.

The Palm OS makes a distinction between communicating with the active application and communicating with a possibly nonactive application. In this first case, the active application is busy executing an event loop, and can be communicated with by posting events to the event queue. As shown earlier in our example, this was how our application got closed; the appStopEvent was posted to the event queue. When the active application gets that event, it quits.

Because there are other times that your application gets called by the Palm OS, there needs to be a way to communicate with it in those instances as well. First, let’s look at a partial list of the circumstances under which the system might want to talk to your application:

  • When the user does a Find, the system must ask each installed application to look for any records that match the Find request.

  • When beamed data is received, the system must ask the appropriate application (the one that is registered to receive the data) to handle the incoming item.

  • When a HotSync occurs, each application is notified after its data has been synced.

  • After a reset, each application is notified that a reset has occurred. ...

Get Palm OS Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.