Email:   
Home
In This Issue
EasyPrint
Click here for the RSS feed's XML code. This is not a browser URL.
Setting application preferences (continued)

Saving and restoring preferences
Using Palm OS preferences is simple: special APIs read and write them. These APIs simply save a user-defined structure. You put whatever data you want in that structure. You don't need to open the database or know an index or record number; these APIs refer to the data by the application's Creator ID.

Early Pilot 1000s and 5000s running Palm OS version 1 only used a single preferences database. When the PalmPilot came out with Palm OS version 2, it added an additional database and several more preferences APIs.

Initially the preferences database was backed up like any other database. Typically this is what you want. If the PalmPilot's memory is wiped out and restored from the backups, all the application preferences are restored as well. This database is called the "saved preferences."

PalmOS version 2 added the "unsaved preferences" database. Just as you'd expect from its name, this database doesn't get backed up. If the Palm device is hard-reset and reloaded from backup data, those unsaved preferences are gone. Personally, I don't see any use for it. I always save preferences. I'd rather take a few extra moments when I HotSync and be sure that I can restore everything to exactly the way it is now. But perhaps you have data that needs to survive between runs, but needn't (or shouldn't) be backed up. Then you'd use the unsaved preferences.

You use the same APIs for saved and unsaved preferences. The last argument in the call determines which database you're saving into.

Creator IDs
Each application is identified by a 32-bit value called the Creator ID, displayed as four characters. The Palm Creator Database web site says to use characters in the ASCII range from exclamation mark through tilde; 0x21 through 0x7E. Palm maintains a database of creator IDs used by existing applications. This database may be read at http://www.palm.com/devzone/crid/cridsub.html. You can register new creator IDs at this same address.

In the case of Hello World and last month's Rocketship, I used a creator ID of "XXXX". As Rocketship will evolve into a real application I registered the ID "ajwR" for it. The creator ID is arbitrary. I just used my initials and "R" for "Rocketship".

The preferences APIs
Palm OS version 2 (and later) changed the names of the preferences APIs used by OS version 1. This was done so that programs would default to the newer APIs. If you don't change the function name to the new name, you'll build using the newer API. The problem with this is that if you use the newer APIs you'll crash on a Palm 1000 and 5000 (unless they've been upgraded, of course).

The newer APIs provide some additional functionality, so there's reason to use them, but you must be aware that the program is no longer compatible with the older Pilots.

In Rocketship, I use the the older APIs where I must, and the newer APIs if they're available. I'll explain that later.

Palm OS version 1
The original preferences APIs are available in all current PalmPilots from the Palm 1000 and 5000 through the Palm III.




[ Prev | Next ]

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2008, ZATZ Publishing. All rights reserved worldwide.
Editor's Login